Can I tell PHP that the user does not have javascript?

Is it possible to tell PHP that the user does not have javascript?

+3
source share
4 answers

Start by assuming javascript is disabled or unavailable, then send some HTML to the client that includes this

<script>
window.location = "http://www.mysite.com/javascript.php?enabled=true";
</script>
<noscript>
possible tell the user the consequences of not having javascript enabled

</noscript>

In the javascript.php script, you can save in the session that the client supports javascript. You can also use the XMLHTTPRequest object, rather than direct redirection.

, , Javascript, , , script . , , , .

+2

JavaScript, PHP , cookie, , . .

JavaScript XMLHttpRequest, PHP . , .

? .

+2

Of course, just use the AJAX call for ...;)

I can’t think about how to do this without direct user interaction. If you have any form / link that your user is going to send to the server, in any case you can have a part of it (some element <inputor add an additional URL to the link) in the tags <noscript>so that the data is only sent by the user when Javascript is off.

0
source

Source: https://habr.com/ru/post/1714785/


All Articles