question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Works cross-domain, but on same domain I get `Invalid target origin 'about:blank' in a call to 'postMessage'.`

See original GitHub issue

Hey there,

When I first started using this library, I had my local app (my-app.dev) hosting the content, and I was loading the iframe on another domain (my-test-app.herokuapp.com) to make sure it worked cross-domain. To my delight, it worked immediately the first time. Yay!

But then I went to embed the iframe on the same domain, and I started getting this error about the targetOrigin being about:blank:

[iFrameSizer][Host page: ma8a3c1b436e7cd6fdc36f2a160e3c4e4d440ad87-container] [init] Sending msg to iframe[ma8a3c1b436e7cd6fdc36f2a160e3c4e4d440ad87-container] (ma8a3c1b436e7cd6fdc36f2a160e3c4e4d440ad87-container:8:false:true:32:true:true:null:bodyOffset:null:null:0:false:parent:scroll) targetOrigin: about:blank
iframeResizer.min.js:8 Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin 'about:blank' in a call to 'postMessage'.

Not sure if this matters, but I’m hosting iframeResizer.min.js on S3, and I’m loading everything with // (vs. https:// or http://) to ensure protocols match.

Not sure where to go here, but I’ll keep hacking and report back what I uncover.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ryanacommented, Jul 26, 2016

Ah! I was using HelloBar and it embeds an iframe with src="about:blank". I was calling window.iframeResize() and not using the selector option. When I add a class it works: iFrameResize({}, "iframe._my-special-widget-iframe")

Hope this helps someone else!

0reactions
davidjbradshawcommented, Jul 26, 2016

Thanks for the follow up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'postMessage' on 'Window': Invalid target ...
The 2nd parameter to postMessage is the "target origin". This is the domain where the page is located, not the name of the...
Read more >
Same-origin policy - Web security | MDN
The same-origin policy is a critical security mechanism that restricts how a document or ... Two URLs have the same origin if the...
Read more >
Iframe Cross-Domain Tracking In Google Tag Manager
How to track iframes with cross-domain parameters using Google Tag Manager ... Analytics to circumvent the web browser's same-origin policy.
Read more >
Window.open() - Web APIs
The Window interface's open() method loads the specified resource into the new or existing browsing context (window, <iframe> or tab) with the specified ......
Read more >
Advanced iFrame – WordPress plugin
After 10.000 views/month the iframe is still working but below the iframe a small ... Check if the iframe page and the parent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found