JavaScript Window stop() Tutorial

In this section, we will learn what the window stop() method is and how to use it in JavaScript.

JavaScript Window stop() Method

Using the `stop()` function, we can stop a webpage from loading its content.

Essentially, it’s like we’re opening a page and all of a sudden hit the stop button of the browser to stop loading that webpage.

Window stop() Method Syntax:

window.stop()

Window stop() Method Parameter:

The method does not take an argument.

Window stop() Method Return Value:

There’s no return value from calling this method.

Example: JavaScript stop page load

See the Pen JavaScript stop page load by Omid Dehghan (@odchan1) on CodePen.

Here we have a paragraph, but if you take a look at the page, you won’t see any content. This is because before the rendering engine reaches to this paragraph, a call to the `stop()` function occurred and the rendering stopped before printing the paragraph on the page.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies