Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS Tracking Client] Safari iframe cross-domain error "Blocked a frame with origin..." #12972

Open
jfroom opened this issue May 24, 2018 · 5 comments
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users.

Comments

@jfroom
Copy link

jfroom commented May 24, 2018

When loading Matomo 3.5.0's piwik.js tracking client script into an HTML file that is loaded into an iframe on a different domain — Safari 11.1 (MacOS 10.13.4) throws the error below. See example CodePen link which loads the Matomo site into an iframe. This is a generalized use case for a widget app with Matomo tracking that would load onto a client domain.

https://codepen.io/jfroom/pen/YLbpWa

[Error] Blocked a frame with origin "https://matomo.org" from accessing a frame with origin "https://s.codepen.io". Protocols, domains, and ports must match.
    Q (piwik.js:41:1708)
    addTracker (piwik.js:61:854)
    ac (piwik.js:23)
    c (piwik.js:70:685)
    aa (piwik.js:71:341)
    addTracker (piwik.js:72:245)
    (anonymous function) (piwik.js:293:273)
    Global Code (piwik.js:293:818)

The issue is thrown by frameElement = windowAlias.frameElement; within /js/piwik.js#isInsideAnIframe.

From my cursory searching, the approaches within this function must have worked fine in the past. Recent Safari however (which has tightened security overall), doesn't seem to allow for try/catch silencing of the error.

Piwik continues to send tracking events after this error is thrown, but the isInsideAnIframe method returns false which may be causing other issues in the tracking code related to the heartbeat.

Ideally, this error would also not be thrown on client websites that piwik/matomo tracker is iframed into.

@Jamie452
Copy link

Jamie452 commented Jul 3, 2018

+1

1 similar comment
@kai-mattern
Copy link

+1

@b-pfl
Copy link

b-pfl commented Jun 5, 2019

I can confirm this behavior. Is there any update on how to prevent that error?

@Findus23 Findus23 added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label May 24, 2020
@invokablegmbh
Copy link

+1

@justinvelluppillai
Copy link
Contributor

hi all, can anyone please confirm if this issue still exists?

@justinvelluppillai justinvelluppillai added this to the For Prioritization milestone Nov 14, 2022
@sgiehl sgiehl added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users.
Projects
None yet
Development

No branches or pull requests

8 participants