Can we inject bunch of CSS files into an iframe from a third party like OAS which is hosting ads? If it is possible an example will be greatly appreciated.
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Adding a timeout to a render function in ReactJS
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
By using jQuery selectors, you should be able to do that. However there should not be any restriction on iframe contents (i.e it should be from same domain)
For HTML update:
$('iframe').contents().find("body")
will get you body object$('iframe').contents().find("head")
will get you header object. You can add style herePlease refer this Tutorial for details
http://code.tutsplus.com/tutorials/how-to-inject-custom-html-and-css-into-an-iframe--net-22826
and this
https://github.com/NETTUTS/Inject-HTML-and-CSS-into-iFrame/blob/master/iframe.html
If the iframe is from different domain then it is not possible due to http://javascript.info/tutorial/same-origin-security-policy