1

I have an Index.php page that launches a JQuery dialog (in modal mode). Dialog consists of a login form. When form gets submitted an Ajax request is sent to another php file (where the request gets handled). If request is succeded I just close the dialog.

I know I can use <noscript> tag. But what if I disable javascript, at any time I wish?. Is it possible to respond (redirect user to a login page) dynamically?

Thanks!

3
  • Disabling javascript takes a page refresh to take effect. Probably. At least in chrome. And firefox. Commented Jul 20, 2012 at 8:45
  • 1
    99,99% of the browser have javascript enabled by default and users rarely disable it. the most solid solution i believe it to use a noscript tag and ask user to either enable javascript or visit a url to a page that handles requests from browser with javascript disabled. Commented Jul 20, 2012 at 8:57
  • Yes I know. But I'm confused whether javascript-disabling, especially in IE, triggers page to refresh (so it could then use <noscript>)? Maybe I don't quite understand the flow. But I thought that '<noscript>' gets handled on load? Commented Jul 20, 2012 at 9:04

3 Answers 3

2

This will helps you ..
If the script was turned off in the page this will automatically redirect the page to the specified url in the given meta tag
and if java script is enabled it will comment the redirecting meta tag

 <script type="text/javascript" language="JavaScript">
  document.write("<!"+"--") </script> <meta http-equiv="Refresh" content="0; URL=noscript.html"> <!--//-->
Sign up to request clarification or add additional context in comments.

Comments

1

I never did this but have you tried to put this in the <header> :

<noscript>
    <meta http-equiv="refresh" content="0;URL=/other-page.html">
</noscript>

I don't know if the solution works, but it's possible it does :)

1 Comment

it cannot be nested in <head>. It should be nested within <body> tag
1

Thanks, guys!

After searching it comes out that making it like:

<noscript>
    <meta http-equiv="refresh" content="0;URL=/other-page.html">
</noscript>

is quite dirty regarding to html validness (<head> tag not supposed to nest <noscript> tag, neither body supposed to contain <meta> tag). Also I've read that it's possible to supress the effect/use of

<meta http-equiv="refresh" content="0;URL=/other-page.html">

Well. So there's a scenario came to my mind:

<body>
    <noscript><?php /* ?></noscript> 
    <ul>
        <li><a href="some_actionA.php"></li>
        <li><a href="some_actionB.php"></li>
        <li><a href="some_actionC.php"></li>
    </ul>
    <noscript><?php */ ?><p class="note">to proceed: Turn on Javascript!</p></noscript>
</body>

No need to make redirects!

Edit

Oops..

It cleans <body> even if Javascript is enabled( So I ended up with two pages Login.php and Index.php. Inside Login.php I check for javascript support. If that's not supported message is shown to the user.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.