Noscript to redirect (I need to redirect) [duplicate]
Asked Answered
H

3

11

I want to disallow access to my website when the user does not have Javascript. I do not with to simply display a message. How would I go about doing this? None of the other questions are quite the same in the sense of disallowing access.

Something like this:

<noscript>
Redirect to another page.
</noscript>

But I've seen that this is not good to do? I repeat though, I do not simply want to display a message.

Thanks.

Hally answered 15/9, 2013 at 8:19 Comment(0)
A
33

You may try this:-

<noscript>
<a href="">Click here to continue</a>
</noscript>

or

<noscript>
  <meta http-equiv="refresh" content="0;url=noscript.html">
</noscript>
Amick answered 15/9, 2013 at 8:21 Comment(2)
<noscript> <?php header("Location: $url"); ?> </noscript>Neville
@Nadia, that doesn't work.Prehuman
O
2

Here is an solution from another post. <meta http-equiv="refresh" content="0; url=http://example.com/">

Oriya answered 15/9, 2013 at 8:24 Comment(0)
T
1
  1. Have your landing page be your NON-JavaScript warning page.
  2. Include a peice of JavaScript called from onload to re-direct to your REAL page (where you assume the end-user has JavaScript).
Tera answered 15/9, 2013 at 8:25 Comment(6)
This would slow down the process for an average user though. I see what you're thinking though.Hally
So would META HTTP-EQUIV based refresh. There's a downside to everything.Tera
Would you be able to explain why META HTTP-EQUIV would too?Hally
In the general case it's it also exhibits a delay. By putting it in <noscript> you limit its effects to NON-JavaScript browsers.Tera
@KriiV:- There are two drawbacks for META refresh tags:- 1 If a page redirects too quickly (less than 2-3 seconds), using the "Back" button on the next page may cause some browsers to move back to the redirecting page, whereupon the redirect will occur again. This is bad for usability, as this may cause a reader to be "stuck" on the last website.Amick
@KriiV:- 2 A reader may or may not want to be redirected to a different page, which can lead to user dissatisfaction or raise concerns about security. Check this out:- en.wikipedia.org/wiki/Meta_refresh#DrawbacksAmick

© 2022 - 2024 — McMap. All rights reserved.