|
Posted by Jonathan N. Little on 11/12/06 15:04
Vince Morgan wrote:
> "Jonathan N. Little" <lws4art@centralva.net> wrote in message
> news:de0d1$4555cd88$40cba7bf$14257@NAXS.COM...
>>> <body onLoad="window.top.location='NoJavaPage.html';" id="main"
> class="">
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> That's JavaScript between the two quotes! It will not work if JavaScript
>> is disabled
>>
>>> <p></p>
>>> </body>
>>> </html>
>> The only way I can see it to make this page the non-JavaScript page and
>> use JavaScript function to change to the JavaScript page, that way the
>> page will only be redirected *if* JavaScript is enabled.
>>
>> --
>> Take care,
>>
>> Jonathan
>
> Thank you very much Jonathan.
> I think your idea is a good one. However, I couldn't find a way for the
> non-JS page not to show prior to the redirection.
> There is another way though. One that allows for a very small switchboard
> type page.
Then you are not really disabling JavaScript.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> <title></title>
> <meta http-equiv="Refresh" content="0; url=Non-JS-Page.html">
^^^
I believe on meta refresh the content must be a non-zero value.
> <script type="text/javascript">
> window.top.location="JS-Page.html";
> </script>
> </head>
> <body>
> <p></p>
> </body>
> </html>
>
> I don't have enough knowledge about <meta>, or any html for that matter, to
> know if the above will work in most browsers.
> My previous programming experience is with languages that are lower level
> and strictly standardised so I'm finding it a bit difficult following all
> the incompatibilities in browsers.
> Having said that, do you see any serious issues with the above code?
Look, with page non-js.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Non-JavaScript Page</title>
<script type="text/javascript">
window.top.location="js-page.html";
</script>
</head>
<body>
<p>This is the Non-JavaScript Page, no redirect will occur if JavaScript
is disabled</p>
</body>
</html>
And js.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>JavaScript Page</title>
</head>
<body>
<p>This is the JavaScript Page, you will only reach here is JavaScript
is enabled</p>
</body>
</html>
So the logic flow is:
Call the Non-JavaScript page which as the JavaScript function
JavaScript is enable?
YES, then JavaScript function redirects bowser to JavaScript page
NO, then no redirection occurs and the Non-JavaScript page remains
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|