Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Document not defined in iframe Firefox

  • 1 reply
  • 3 have this problem
  • 12 views
  • Last reply by guigs

more options

Hello, i am having an issue with firefox when i am trying to evaluate javascript in side the href of an anchor in an iframe. I know that is not good practise but its the only practise open to me with SSRS. The code evaluates correctly when the page is not open within an iframe, but when within an iframe i get a

exception: ReferenceError: document is not defined

You can see the code running in page.png and the failure in iframe.png I have the same question in stackoverflow. And at the end i am attaching the code of the button.


http://stackoverflow.com/questions/32267132/document-not-defined-in-iframe-firefox




<a tabindex="1" href="javascript:eval%20(%20%20%20%20%20unescape%20%20%20%20%20('var%20elementIterator%20=%20document.evaluate(%20%5C'%5C/%5C/tr%5B@isparameterrow=%5C%5C%5C'true%5C%5C%5C'%5D%5C/td%5C/label%5C/span%5C'%20,document,%20null,%20XPathResult.ANY_TYPE,%20null%20);%5Cr%5Cn%20%20%20%20var%20params%20=%20%5B%5D%5Cr%5Cn%20%20%20%20while%20(elem__%20=%20elementIterator.iterateNext())%20%7B%5Cr%5Cn%20%20%20%20%20%20%20%20var%20param=%7B%7D;%5Cr%5Cn%20%20%20%20%20%20%20%20console.log(elem__.innerHTML);%5Cr%5Cn%20%20%20%20%20%20%20%20var%20elem_val%20=%20elem__.parentElement.parentElement.nextSibling.firstChild.firstChild.nextSibling;%5Cr%5Cn%20%20%20%20%20%20%20%20switch(elem_val.type)%20%7B%5Cr%5Cn%20%20%20%20%20%20%20%20case%20%5C'text%5C':%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.value%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.value)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20case%20%5C'select-one%5C':%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.options%5Belem_val.selectedIndex%5D.innerHTML%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.options%5Belem_val.selectedIndex%5D.innerHTML)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20case%20undefined:%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.firstChild.nextSibling.value.replace(%5C/;%5C/g%20,%20%5C',%5C')%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.firstChild.nextSibling.value)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20default:%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20%5C'ALL%5C'%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(%5C'unknown%5C')%5Cr%5Cn%20%20%20%20%20%20%20%20%7D%5Cr%5Cn%20%20%20%20%20%20%20%20params.push(param)%5Cr%5Cn%20%20%20%20%7D%5Cr%5Cn%20%20%20%20console.log(JSON.stringify(params))%5Cr%5Cn%20%20%20%20window.parent.postMessage(JSON.stringify(params),%20%5C'*%5C');')%20)" style="text-decoration:none;" target="_top"></a>

Hello, i am having an issue with firefox when i am trying to evaluate javascript in side the href of an anchor in an iframe. I know that is not good practise but its the only practise open to me with SSRS. The code evaluates correctly when the page is not open within an iframe, but when within an iframe i get a exception: ReferenceError: document is not defined You can see the code running in page.png and the failure in iframe.png I have the same question in stackoverflow. And at the end i am attaching the code of the button. http://stackoverflow.com/questions/32267132/document-not-defined-in-iframe-firefox <a tabindex="1" href="javascript:eval%20(%20%20%20%20%20unescape%20%20%20%20%20('var%20elementIterator%20=%20document.evaluate(%20%5C'%5C/%5C/tr%5B@isparameterrow=%5C%5C%5C'true%5C%5C%5C'%5D%5C/td%5C/label%5C/span%5C'%20,document,%20null,%20XPathResult.ANY_TYPE,%20null%20);%5Cr%5Cn%20%20%20%20var%20params%20=%20%5B%5D%5Cr%5Cn%20%20%20%20while%20(elem__%20=%20elementIterator.iterateNext())%20%7B%5Cr%5Cn%20%20%20%20%20%20%20%20var%20param=%7B%7D;%5Cr%5Cn%20%20%20%20%20%20%20%20console.log(elem__.innerHTML);%5Cr%5Cn%20%20%20%20%20%20%20%20var%20elem_val%20=%20elem__.parentElement.parentElement.nextSibling.firstChild.firstChild.nextSibling;%5Cr%5Cn%20%20%20%20%20%20%20%20switch(elem_val.type)%20%7B%5Cr%5Cn%20%20%20%20%20%20%20%20case%20%5C'text%5C':%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.value%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.value)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20case%20%5C'select-one%5C':%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.options%5Belem_val.selectedIndex%5D.innerHTML%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.options%5Belem_val.selectedIndex%5D.innerHTML)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20case%20undefined:%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20elem_val.firstChild.nextSibling.value.replace(%5C/;%5C/g%20,%20%5C',%5C')%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(elem_val.firstChild.nextSibling.value)%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20break;%5Cr%5Cn%20%20%20%20%20%20%20%20default:%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20param%5Belem__.innerHTML%5D%20=%20%5C'ALL%5C'%5Cr%5Cn%20%20%20%20%20%20%20%20%20%20%20%20console.log(%5C'unknown%5C')%5Cr%5Cn%20%20%20%20%20%20%20%20%7D%5Cr%5Cn%20%20%20%20%20%20%20%20params.push(param)%5Cr%5Cn%20%20%20%20%7D%5Cr%5Cn%20%20%20%20console.log(JSON.stringify(params))%5Cr%5Cn%20%20%20%20window.parent.postMessage(JSON.stringify(params),%20%5C'*%5C');')%20)" style="text-decoration:none;" target="_top"><img onload="this.fitproportional=true;this.pv=0;this.ph=0;" src="/ReportServer/Reserved.ReportViewerWebControl.axd?ExecutionID=m2epq5m3tb5utoiypx3rnlq2&amp;Culture=2057&amp;CultureOverrides=False&amp;UICulture=9&amp;UICultureOverrides=False&amp;ReportStack=1&amp;ControlID=b385c121b40f4554a1f5c14eeb885529&amp;OpType=ReportImage&amp;IterationId=b3aeb408b2014a51bcea7277af910bf1&amp;StreamID=d5faf78f-1783-4393-b5c8-26f9afbdebb6" border="0" height="35" width="93"></a>
Attached screenshots

All Replies (1)

more options