faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

60 of 90 people (67%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Can I detect and reload the page if Javascript is disabled after the page has loaded?

Apr 4th, 2008 19:40
ha mo, David Blackledge, Henk-Johan van Rantwijk, Kenneth Kephart, Hatto von Hatzfeld, Harpo Veld,


Sorry, you can't detect if a javascript is disabled.  However you can
reload the javascript using a link on the page.  By reloading the page
you will enable the javascript.
The following example shows that when the user clicks the link they
will reload the javascript on the page.
ex.
<a href="javascript:location.reload()">Reload Javascript</a>
READ THIS:
But that does not work for Opera Browsers!
---------------------------
If what you want is to go to another page when JavaScript isn't enabled 
on the current browser, you can place this in the head of your page:
<NOSCRIPT>
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=content.html">
</NOSCRIPT>
If they don't have JavaScript enabled (or it's not supported), they will 
be taken to the page "content.html" in 2 seconds.  If JavaScript is 
enabled, the Refresh command will be ignored.
This of course only works if the browser supports the "Refresh" command 
(both IE5 and NS4 do... not sure about others).
Change the number of seconds and the URL for whatever you need.
David.
http://David.Blackledge.com
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com