How to block frame on a website (Firefox)?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
9,146
Reaction score
10,489
I visit a website sometimes, and I checked the code and it seems to load 2 frames on the page. Something like this:

Code:
<frame name="frame1" src="something something" scrolling="no" noresize="">

<frame name="frame2" src="something something" scrolling="auto" noresize="">

I want to block or hide or prevent "frame2" from loading.

I went to google and I tried to find a way to do it using uBlock or Greasmonkey, but to my surprise I didn't find anything.

Anyone knows how I can do it?

Thanks
 
Using ublock? Hover over the element you are trying to block -> right click on it -> click on "block element". It will give you a nice looking ui that you can use to preview the element you are trying to block. When you are sure that is the element, click on "create" in the bottom right panel. Bam, it will be gone instantly.
 
Using ublock? Hover over the element you are trying to block -> right click on it -> click on "block element". It will give you a nice looking ui that you can use to preview the element you are trying to block. When you are sure that is the element, click on "create" in the bottom right panel. Bam, it will be gone instantly.

It doesn't have to be uBlock, I'd be willing to use anything - uBlock, Greasemonkey, a Firefox extension, something else...

So I tried uBlock, and when I click to block element nothing happens. Were is this nice looking UI you speak of? :D

And since I'm running an older version of Firefox and older version of uBlock, I installed an updated uBlock on my main updated Firefox, and the same thing happens. You click to block element, and nothing happens at all :/
 
And since I'm running an older version of Firefox and older version of uBlock, I installed an updated uBlock on my main updated Firefox, and the same thing happens. You click to block element, and nothing happens at all :/
oh right :D

U are a special case :D :D
Sorry man, perhaps try checking out the firefox project and "make" it yourself. Perhaps patch the feature that presents you the UI. Shouldn't be too hard (just kidding). :)
 
oh right :D

U are a special case :D :D
Sorry man, perhaps try checking out the firefox project and "make" it yourself. Perhaps patch the feature that presents you the UI. Shouldn't be too hard (just kidding). :)

Always a special case haha

I got it working on my main Firefox. But it won't allow me to block element, it only allows me to block element in frame.

I think this site has some protection against blocking elements like I'm trying to do.

Any other ideas?
 
Always a special case haha

I got it working on my main Firefox. But it won't allow me to block element, it only allows me to block element in frame.

I think this site has some protection against blocking elements like I'm trying to do.

Any other ideas?
Or you could simply make a greasy monkey script (not sure how that shite works) to remove that element on load. Perhaps something like $('[name="frame2"]').remove()?
That will only work if the site has jquery. If you translate that to vanilla js code, it will work everywhere. :D
 
Or you could simply make a greasy monkey script (not sure how that shite works) to remove that element on load. Perhaps something like $('[name="frame2"]').remove()?
That will only work if the site has jquery. If you translate that to vanilla js code, it will work everywhere. :D

Oh shit. That actually worked when I run it on the console :o

But not when I run it with Greasemonkey. Maybe because the code executes immediately with greasemonkey, while the frame loads after a few seconds?
 
Oh shit. That actually worked when I run it on the console :eek:

But not when I run it with Greasemonkey. Maybe because the code executes immediately with greasemonkey, while the frame loads after a few seconds?

A crappy solution for that would be to run it with a timeout or when the full page has loaded.

So either:

Code:
$( document ).ready(function() {
   $('[name="frame2"]').remove()
});

Or:

Code:
setTimeout(function(){

   $('[name="frame2"]').remove()

}, 1000);

Also make sure that you have the right options for the script so it actually executes on the domain.
 
Oh shit. That actually worked when I run it on the console :eek:

But not when I run it with Greasemonkey. Maybe because the code executes immediately with greasemonkey, while the frame loads after a few seconds?
A crappy solution for that would be to run it with a timeout or when the full page has loaded.

So either:

Code:
$( document ).ready(function() {
   $('[name="frame2"]').remove()
});

Or:

Code:
setTimeout(function(){

   $('[name="frame2"]').remove()

}, 1000);

Also make sure that you have the right options for the script so it actually executes on the domain.
Or better yet,
Code:
$(document).ready(function(){
    $('[name="frame2"]').remove()
});

But then, it's a greasymonkey script, not Scorpion's gf. :p
 
A crappy solution for that would be to run it with a timeout or when the full page has loaded.

So either:

Code:
$( document ).ready(function() {
   $('[name="frame2"]').remove()
});

Or:

Code:
setTimeout(function(){

   $('[name="frame2"]').remove()

}, 1000);

Also make sure that you have the right options for the script so it actually executes on the domain.

I got it working perfectly, look below...

Or better yet,
Code:
$(document).ready(function(){
    $('[name="frame2"]').remove()
});

But then, it's a greasymonkey script, not Scorpion's gf. :p

Pfff, what you talking about homie? Me and GS so tight we might as well be married :p

---

So a couple of days ago I was blocking something else, and I had the same issue where a page would load before a certain element on the page, and Greasemonkey wouldn't block the element because GS would execute immediately.

So I found a solution, but I don't rememeber exactly. This was a few days ago and I sort of just do things on the fly and move on.

But anyway I mixed that with what we got here, and I got a working thing. Oh I also added a require jquery code thingy. Not sure if it's needed, but whatever, the code works! ;)

Here is the code:

Code:
// ==UserScript==
// @name        block
// @namespace   123
// @include     https://www.stupidsute.com/*
// @version     1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant       none
// ==/UserScript==



window.addEventListener('load', function() {
 
  $(document).ready(function() { //When document has loaded
 
$('[name="frame2"]').remove()

});

  }, false);
 
Okay so I tried the code without this bit:

Code:
@require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

And it didn't work.

Okay so that stays, it appears to be necessary.
 
All right guys I tested it thoroughly. You know, hours and hours of testing, artificial intelligence, alien technology, the blockchain, quantum, black magic. It works!

Thanks guys, you're the shit! :D

 
A crappy solution for that would be to run it with a timeout or when the full page has loaded.


Code:
setTimeout(function(){

   $('[name="frame2"]').remove()

}, 1000);

@Gogol @UpwardDescent So I changed to this.

Because often what loads in the frame would slow down the loading of the entire page. So if the script waits to execute when the page is fully loaded it's not as efficient. But if the script just starts executing over and over again from the moment the page starts loading, it's gonna catch the frame as soon as it appears and shut it down, therefore allowing the rest of the page to load faster.

I'm still testing, but I think that's it, and the perfect solution.
 
Back
Top