Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

How to redirect if javaScript is disabled?

I have a site which relies heavily on javaScript. I created a mirror site, which has all the JS as well as all the elements that require JS removed. What is a good, easy way to redirect users to the mirror site if they don't have javaScript enabled?

I tried this, but it doesn't seem very good:

<noscript>
  <meta http-equiv="refresh" content="0; URL=nojs/index.php">
</noscript>

I also tried to putting header-redirect into the noscript tag, but that didn't work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
<noscript>
    <p>This site is best viewed with Javascript. If you are unable to turn on Javascript, please use this <a href="http://sitewithoutjavascript.com">site</a>.</p>
</noscript>

Some people purposely disable Javascript, and you might want to give them a chance to turn it on before redirecting them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...