0

I have been taught that one can not apply CSS to cross origin iframes, but I have found that Stylebot applies CSS to iframes successfully with no problem at all.

  1. How is this possible?
  2. Is there any chance I can do the same in my website?
Ariel
  • 359
  • 4
  • 5

1 Answers1

2

You can't apply custom CSS to cross-origin iframe ( you can only if you have direct access to the both servers )

But..

Extensions can avoid those rules because files in extensions have different policy rules. So basically you can add a JavaScript file to each and every page or iframe. And from there you can basically do anything. And this JavaScript file that was injected by your extension will never be blocked. Each and every browser has its own API, about Chrome's way of doing things you can read here : https://developer.chrome.com/extensions/content_scripts

About extensions you can read here: https://developer.chrome.com/extensions/getstarted

Satwik Nadkarny
  • 5,086
  • 2
  • 23
  • 41
obenjiro
  • 3,665
  • 7
  • 44
  • 82
  • 1
    I already stated that that's what I have been taught. - It's very clear stylebot is an extension - It's very clear extensions are installed manually - It's very clear CSS *can't* be applied directly to iframes. Nevertheless extensions ignore these rules. **Can you explain to me (in a practical way) how extensions make it possible?** – Ariel May 28 '15 at 14:22
  • Plz look at the update. – obenjiro May 28 '15 at 14:34
  • Definitely much better. – Ariel May 28 '15 at 14:37