[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Force page using JavaScript



> Is there a way to force the movement of a page using JavaScript? Basically,
> I have a page setup that if you don't have a JavaScript Browser, you don't
> need to be there. If you do, I'd like to have JavaScript load up that page.
> If you don't, just a text page saying you got to have a JavaScript capable
> browser.

If what you are asking is if there is a way to make non-JavaScript 
browsers display a message saying they need a JavaScript capable 
browser to view the file, the answer is yes. The following will work.

<script language="javascript">
<!--
put JavaScript code that loads page here
// -->
</script>

<P>
Sorry, you need a JavaScript capable browser such a Netscape 2.0 to view
this file - <A HREF=#your_home_pageURL>Return to my Home Page</A>
</P>

If the browser recognizes the <script> tags, it will ignore the 
internal comments and execute the code. If the browser does not 
recognize the <script> tags it will ignore them, recognize the 
internal comments, and then fall through to the code below the ending 
comment and <script> tag.

For an example of this in action go to http://community.net/~jray/
and select the 'Cookies and Banners' link. Netscape2.0  and Internet 
Explorer are two good choices for the test.

This example also uses frames  and checks for Netscape 2.0b5 and 
higher but this doesn't affect the concept.

John
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/