window.stop not working

Forums » General Opera topics » User JavaScript

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

22. April 2010, 14:03:46

curaga

Posts: 61

window.stop not working

Hi, I have this userscript:

if (window==top.frames[1]) {
                  window.stop();
}


There's some detection around that, but that's the core. If I put an alert(location.href) in there, I get the correct result, and before the frame is completely loaded.

The intention is to stop the loading of a single heavy frame on a certain site. It's not working however, and no errors in the log. The frame completely loads.

Any hints?

22. April 2010, 14:14:53

xErath

javascript guru

Posts: 6588

Try
document.removeChild(document.documentElement);
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

22. April 2010, 15:10:59

curaga

Posts: 61

Wouldn't that remove the frame? I need the frame itself to still exist, as some links open in it.

22. April 2010, 15:22:44

xErath

javascript guru

Posts: 6588

No. Try it, inside your if block.
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

22. April 2010, 17:00:32

curaga

Posts: 61

Thanks, working great.

Could you explain why window.stop wouldn't work? It's described as doing the same as the browser stop button.

24. April 2010, 01:28:45

xErath

javascript guru

Posts: 6588

window.stop is the same as clicking the stop button on a top level document, and is a no-op elsewhere.
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

Forums » General Opera topics » User JavaScript