Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 651
zeckdude Avatar asked Mar 22 '10 00:03

zeckdude


People also ask

How do I redirect a page without JavaScript?

To redirect from an HTML page, use the META Tag. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value of the content is the number of seconds; you want the page to redirect after. Through this, you can automatically redirect your visitors to a new homepage.

What is JavaScript 301 redirect?

“If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location.”

What are JavaScript redirects?

A JavaScript redirect is a piece of JavaScript code that is used to automatically transfer a visitor from a landing page to a different target page.


1 Answers

<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.

like image 169
Tyler Carter Avatar answered Oct 03 '22 18:10

Tyler Carter