The only way to find out if you are in ifrmae is with window not top .
if (window == top) { // Not in iframe } else { // In an iframe }
You can only do this for content scripts, not for style sheets. I usually do this in the contents of the script, I check to see if it is in the top window, and then continue the script, otherwise I will just end it.
Summary
- Paste Script content for this URL
- In the contents of the script, check if the property is window,
if (window != top) { loadContentScript() } - Create CSS in JavaScript if you are too worried about this. You should not if using unique identifiers.
Hope this helps, I am doing this for several extensions.
Mohamed mansour
source share