IE, Opera and Netscape issues on ‘Stop page loading’ with javascript

In case you don't know what i am referring on the topic, i really mean to stop the page from loading on the background of the browser. Usually, pressing STOP icon in the browser will stop any activity in a browser. Background activity that we are interested are uploading, preloading, retrieving and etc. of any dynamic activity that the browsers are dealing with when the page fire up ajax functionality. There are only three browser that are in my concern list because these are the browsers that are being used today.

Netscape

Netscape browsers are Mozilla Firefox, Google Chrome and Safari. These are Netscape browser which most developers or Mac users used when developing web application and design. Obviously, finding a solution for Netscape page load function is pretty easy and we can also manually press the X button on the top of the browser to stop all activity in a netscape browser. Ultimately, we will know that there is a function in Netscape browser that can stop all activity since the stop button on the browser is performing such action.  In case you are still wondering what the heck is the javascript code,

window.stop();

The above will stop all activity which include stopping the page from loading and preventing any uploading to occurs. Any preload of image will also be stop by this javascript method.

Internet Explorer (IE)

IE having the majority users in the world is still lagging such function. It is possible to stop page from loading by using the following javascript code.

document.execCommand('Stop')

which will return you an empty page when executed during page load. However, this will only stop the page from loading! Other activity such as uploading and preloading of images will still occur. There is practically no way to stop the background activity in an IE browser. If you fire up an ajax application in an IE browser, you won't see any 'activity' at the bottom of the page indicating it is retrieving the request. Pressing stop button won't disable IE from retrieving unless you escape the page which a dynamic web site do not want it. In short, once a request is fired to IE, there is no cancellation for that request.

Opera

Opera work quitte similiar with IE.  Although by interface and efficiency, Opera is much MUCH superior than IE, it still doesn't gain much market share in the browser industry. So how do we stop activity in Opera? There are definitely some way of stopping the activity in Opera which i personally believe. However, due to the small community available for Opera, you won't find any good answer avaliable in Google.  However, Opera can use event bubbling to stop certain event from happening. (this mean it cannot stop event that has already happen)

Summary

The reason for this article is to prevent people like ME who hunt for such solution so that my RIEG jQuery plugin test site can work perfectly in all browser. And the reason why people will want to stop activity in the background of the browser is because in a dynamic environment, we will want to remove the existing DOM element and replace these DOM element with a new one. However, as existing request is still being sent through the browser, it is necessary to stop those existing request before sending out the new request so that the display will be flawless! Unfortunately, this cannot be done. (sad)

2 thoughts on “IE, Opera and Netscape issues on ‘Stop page loading’ with javascript

Comments are closed.