문제

I am trying to stop loading my php page if the javascript is not enabled on user's computer.

below method working fine. However please let me know is it cross browsered and is it safe?

<noscript>
<?php
echo "Please Enable JavaScript in your browser!";
exit;
?>
</noscript>

  <div id="main">
    <!-- #header -->
    <div id="header"> 
        <div id="logo"><a href="homepage.php" title="Go to Homepage"><span><?php echo $Name;?></span></a></div>.....

Please let me know anyother professional way I can do it.

PS: Some of my user tried to disable JavaScript after page load. This thing also affect some of my pages. I am getting wrong values on submit since the js disabled. I wanna overcome this situation please.

도움이 되었습니까?

해결책

You can insert the tag

<title>Your title</title>    
<noscript><meta http-equiv="refresh" content="0; URL=/badbrowser.html"></noscript>

다른 팁

Whilst the redirect certainly works the pages will still continue to load.

I have this problem and was hoping to find a solution. The answer is somewhere between the solutions so far offered:

<noscript>
<meta http-equiv="refresh" content="0; URL=/badbrowser.html">
<?php
exit;
?>
</noscript>

This starts the redirect but also prevents the rest of the PHP page loading.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top