@cgrady17 opened this Issue on April 29th 2016

Following an upgrade to Piwik 2.15.0, we began receiving a SCRIPT5: Access is denied error in Internet Explorer 11 for all of our tracked applications that are viewed within an IFrame. We determined that the offending code was in piwik.js on line 38, column 203. The offending code is below:

function o(){if(z(J.frameElement)){return(J.frameElement&&String(J.frameElement.nodeName).toLowerCase()==="iframe")}try{return J.self!==J.top}catch(Y){return true}}

We've replaced the function's code with return true; as a temporary fix. When IE experiences this error it halts any further execution within the file and this results in no tracking being performed. I can confirm that the issue still exists in 2.16.0 and 2.16.1 as well. I should reiterate this only happens in IE and only for applications viewed within an IFrame.

@tsteur commented on May 1st 2016 Member

Thank you for the bug report. We will investigate this and try to fix it in next release. I presume to reproduce this we need to load the iframe from the different domain / port / ...

Code related to this is https://github.com/piwik/piwik/blob/2.16.1/js/piwik.js#L2694-L2703

@cgrady17 commented on May 2nd 2016

Thanks @tsteur. You're right, it involves IE's same origin policy so the iframe will need to be on a different origin than its parent.

@mattab commented on July 15th 2016 Member


  • wrote a test for the isInsideAnIframe function. the test can be executed at: http://demo2.piwik.org/tests/javascript/?testNumber=35
  • the test is passing on IE11, IE10, IE9 and Chrome and Firefox.
  • not seeing the "exception" being thrown. Maybe the exception is only throw when the domain of the iframe is different from the domain of the parent window @cgrady17 ?
  • on IE8 the test fails with Died on test <a href='/5'>#5</a> undefined: Member not found. which seems to be some weird IE8 bugs rather related with the way the test executes rather than the piwik.js code itself
@mattab commented on July 15th 2016 Member

Maybe the exception is only throw when the domain of the iframe is different from the domain of the parent window @cgrady17 ?

I just saw that you actually wrote it in your PR in the comment If the parent window has another origin so that's cleared. unfortunately i don't think there is a way to generate an iframe on another domain and insert it in the dom, so we can't easily automatically test for this issue.

This Issue was closed on July 15th 2016
Powered by GitHub Issue Mirror