• flickr
  • linkedin
  • twitter
  • rss
Getting around Chrome Javascript error: Chrome Unsafe JavaScript attempt to access frame with URL

Getting around Chrome Javascript error: Chrome Unsafe JavaScript attempt to access frame with URL

In this instance, I had a parent window which launched a bunch of child windows. These child windows needed to run a function on the parent window when a particular function was called.

Since the event dispatcher isn’t widely working with IE just yet it seems, that wasn’t a real option, so I went oldschool and tried to run the functions directly using

window.opener.myFunction();

This worked perfectly in Firefox and IE, but not Chrome! The error comes out as ‘Chrome Unsafe JavaScript attempt to access frame with URL’

After some searching I found a ridiculously simple solution to this particular problem: Chrome’s javascript just doesn’t much like files with file:// at the start for figuring out domains. Ie, chuck it on a server or localhost or something and you’ll be golden.

How stupid.

Tech Reference:

Larry's a 30-something chap interested in travel, being a dork and changing the world via less boring training.

Leave a reply