What we want to achieve
- We would like to keep the XHTML compatibility
- Work in all popular browser (Mozilla Firefox, Internet Explorer, 6-7-8, Opera, Safari, Google Chrome)
I’ve never seen a solution posted anywhere like this, it’s my own idea. It’s a dirty hack, but it works
The way to the solition
In order to be able to jump without JS, the following meta tag can be used:
<meta http-equiv="refresh" content="0; url=nojs.html" />
If we place the above line to the header of the page, the browser immediately jump to the nojs.html.
Another obvious solution is to enclose the above line with <noscript> </ noscript> tags. The problem with this solution is not standard compliant, maybe even not works in all browser. But it was in our terms that we must care of the XHTML standard.
First, here is the code and then explain in detail:
Line by line (without the first and the last line of comment):
“<!-” HTML comment at the beginning has to be there, because the script
contains “<”, “>” signs, which can’t be in valid XHTML, and when the browser doesn’t know about <script>(or it is turned off) then it will miss this section.
- This will redirect the browser if there is no JS.
other level is when there is no JS and the code is XHTML compliant.
A further problem
The user can turn off the meta refresh, although it is very uncommon.
This is a working example: http://web2.bitbaro.hu/jshack/