I'm currently using Chrome 27.
After looking through the settings options (Settings → Privacy → Content settings) I see that I can disable just about anything... except iframes.
Is there any easy way to do this? Is it also possible in IE and Firefox?
72 Answers
I ended up using the extension "stylish"
It lets you target particular urls and then you can add custom styles for that website.
Here's a post in Stack overflow which illustrates this.
So in my case I added the following custom css for the particular website i needed to target
iframe
{ display: none;
}... and it works great!
5Just remove all elements that are iframes with javascript directly in the console
or install a plugin for a more permanent solution like: noscript
Temporary fix
One Line:
(function(){var f=document.getElementsByTagName("iframe");for(var i in f)try{f[i].parentNode.removeChild(f[i]);}catch(e){console.error(e);}})();This will permanently remove the iframes on page. (until the page is refreshed)
To use this live
- open console (F12 key)
- navigate to the console tab
paste the one line or the human code into the
>field and press Enter
Human code:
(function(){
var listOfFrames = document.getElementsByTagName("iframe");
while (listOfFrames /*exists*/ && (listOfFrames.length > 0) ) { try { for (var iterator in listOfFrames) { listOfFrames[iterator] // get the next frame .parentNode // find the parent .removeChild( listOfFrames[iterator] ); // remove the frame from the parent } }catch(e){ // we found a frame that no longer exists console.error(e); } var listOfFrames = document.getElementsByTagName("iframe"); // update the list regardless of errors in case we missed one
} // loop again unless the condition is satisfied
})(); // end of call of the functionBefore you try this
If you don't know your browser's behavior around loops and removing elements make sure everything is saved locally or on the server before you start. Running the code might remove your work. Be sure that you will be okay if your browser crashes.
I edited this because I didn't think it was readable hopefully it's better.
4