1

Is there a way in javascript to simulate pressing the "stop" button the browser whenever a link or button is clicked?

I'm trying to load other websites while displaying a frame at the top of the page, the issue is that sometimes it takes a while to load all the content on a page (especially if there is something being streamed). Is there anyway to make it so I can place a "stop" button or link on my top frame that ceases the loading of anything else?

I checked around but couldn't find anything

Thank you!

Pharm
  • 152
  • 1
  • 12

1 Answers1

4

You can use the window.stop() method, however note that depending on the location of your script, JavaScript is not executed until after the DOM (typical practice), so often times the page will already be loaded before this executes.

For an iframe, simply target the frame and use the stop method.

Sterling Archer
  • 22,070
  • 18
  • 81
  • 118