Question

I've developed extensions in Chrome and Safari, and I've noticed curious differences in behavior in regards to iFrames. The extension I've developed injects content scripts into all sites matching the url pattern:

http://*.nationstates.net/*

On Safari, this extension inject the content scripts into each iFrame whose src also matches this pattern. On Chrome, it only injects the content scripts into each web page that matches, never an iFrame.

The extension code is on Github.

Install Extension for Yourself: http://forum.nationstates.net/viewtopic.php?f=15&t=243404

The easiest place to see this behavior is on here: http://nationstatespostmaster.com/ Clicking an element opens an iFrame to the nation page. On Chrome, the extension is not loaded. On Safari it is.

Was it helpful?

Solution

In Chrome extensions, you can specify "all_frames": true to match all frames in the main page whose URL matches the pattern. However, patterns specified in "matches" only apply to top-level frame URLs. You cannot inject a content script into a sub frame without injecting it into the main frame.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top