Dear readers,
Is there somewhere, maybe $_SESSION vars?, where my PHP knows that
JavaScript is enabled on the clients webbrowser.
I uses some JavaScript but would like to add workaround in case the browser
doesn't. Suggestions would be appreceated.
Tia Jean. 7 4571
Jean Pion wrote: Dear readers,
Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
Tia Jean.
Hi,
You cannot get that information from SESSION vars.
SESSION vars ONLY contains information you put into it.
Also the POST or GET will not help.
You can easily check that in another way.
Try something like this:
[on the startpage where you want to detect Javascript]
<form action="jscheck.php" name="jscheckform" method="post">
<input type="hidden" name="jsenabled" value="N">
<input type="submit" value="continue">
</form>
<script type="text/javascript">
document.forms.jscheckform.jsenabled.value="Y";
</script>
Now on the page jscheck.php you just retrieve the value of jsenabled:
$jsenabled=$_POST["jsenabled"];
// and maybe store it in a session for futher reference
$_SESSION["jsenabled"] = $jsenabled;
Hope that helps.
Regards,
Erwin Moller
On 2005-08-05, Jean Pion <je*******@hotmail.com> wrote: Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser.
That has been already answerd by GM
I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
I think it's easier to write scripts that work without JavaScript. And
then add whatever JS.. This gives you the advantage you don't have to
think about workarounds (Simplest solution is to disable JavaScript).
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
"Erwin Moller"
<si******************************************@spam yourself.com> schreef in
bericht news:42***********************@news.xs4all.nl... Jean Pion wrote:
Dear readers,
Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
Tia Jean.
Hi,
You cannot get that information from SESSION vars. SESSION vars ONLY contains information you put into it. Also the POST or GET will not help.
You can easily check that in another way. Try something like this:
[on the startpage where you want to detect Javascript]
<form action="jscheck.php" name="jscheckform" method="post"> <input type="hidden" name="jsenabled" value="N"> <input type="submit" value="continue"> </form> <script type="text/javascript"> document.forms.jscheckform.jsenabled.value="Y"; </script>
Now on the page jscheck.php you just retrieve the value of jsenabled:
$jsenabled=$_POST["jsenabled"]; // and maybe store it in a session for futher reference $_SESSION["jsenabled"] = $jsenabled;
Hope that helps.
Thanks Erwin,
that sounds fine,
Jean.
"Tim Van Wassenhove" <ti***@users.sourceforge.net> schreef in bericht
news:dc**********@ikaria.belnet.be... On 2005-08-05, Jean Pion <je*******@hotmail.com> wrote: Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. That has been already answerd by GM
Well I was not aware of this, sorry...
And, - risking to sound even more stupid -, who or what might be GM.
And where can I find the answer. I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
I think it's easier to write scripts that work without JavaScript. And then add whatever JS.. This gives you the advantage you don't have to think about workarounds (Simplest solution is to disable JavaScript).
You are probably right, but I inherited a site with js.
Jean.
Jean Pion wrote: Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
After reading the subject, I actually thought this was going to be about
server side javascript... (Which does exist to you nay-sayers.)
One quick solution that I have done before for detecting javascript on a
client is in the document have something like:
<?php
if(!isset($_GET['js']) && !isset($_SESSION['js'])){
$js=<<< eos
<script type="text/javascript">
window.location.href='{$_SERVER['REQUEST_URI']}?js=1';
</script>
eos;
}else{
$_SESSION['js']=1;
$js='';
}
?>
<html>
<head>
<title>Javascript test</title>
<?php echo $js ?>
</head>
<body>
Javascript has <?php if(!empty($js)){ echo '<b>not</b>'; } ?> been
detected on the client.
</body>
</html>
Of course, if the REQUEST_URI already contains a query string, you'd
want to append the js var instead of how I have it above, but it
illustrates the method anyway.
--
Justin Koivisto, ZCE - ju****@koivi.com http://koivi.com
"Erwin Moller"
<si******************************************@spam yourself.com> schreef in
bericht news:42***********************@news.xs4all.nl... Jean Pion wrote:
Dear readers,
Is there somewhere, maybe $_SESSION vars?, where my PHP knows that JavaScript is enabled on the clients webbrowser. I uses some JavaScript but would like to add workaround in case the browser doesn't. Suggestions would be appreceated.
Tia Jean.
Hi,
You cannot get that information from SESSION vars. SESSION vars ONLY contains information you put into it. Also the POST or GET will not help.
You can easily check that in another way. Try something like this:
[on the startpage where you want to detect Javascript]
<form action="jscheck.php" name="jscheckform" method="post"> <input type="hidden" name="jsenabled" value="N"> <input type="submit" value="continue"> </form> <script type="text/javascript"> document.forms.jscheckform.jsenabled.value="Y"; </script>
Now on the page jscheck.php you just retrieve the value of jsenabled:
$jsenabled=$_POST["jsenabled"]; // and maybe store it in a session for futher reference $_SESSION["jsenabled"] = $jsenabled;
There is a drawback to this, being that a button is visible, and one should
click it.
So after some browsing I found the following suggestion to solve this:
<form action="some_url" name="jscheckform" method="post">
<input type="hidden" name="jsenabled" value="N">
</form>
<script type="text/javascript">
<!--
document.forms.jscheckform.jsenabled.value="Y";
document.forms.jscheckform.submit();
//-->
</script>
So, nothing is visible and no need to press any button.
My problem is what to use for action parameter.
I dont wan't to show another page, can I use the same url?
Another is that I currently don't accept post to this page...
Tia, Jean.
<html>
<head>
<meta http-equiv="refresh"
content="0;url=http://www.somedomain.com/?js=0">
<script language=javascript>
<!--
window.location='http://www.somedomain.com/?js=1';
-->
</script>
<style type="text/css">
a,p {
color: 888888;
}
</style>
</head>
<body>
<p>
If the page doesn't refresh, please
<a href="http://www.somedomain.com/?js=0">
Click Here
</a>
</body>
</html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: christian9997 |
last post by:
Hi
We have started off using a $_GET parameter to keep track of the user's
browser:
We detect what browser the visitor is using when he first arrives on
our website then we do a redirect to...
|
by: Stephen Poley |
last post by:
I have quite often (as have probably many of you) come across HTML forms
with irritating bits of Javascript attached. The last straw on this
particular camel's back was a large form I was asked to...
|
by: John Sheppard |
last post by:
Hello there,
I am unsure as to where to ask for help about this, so I thought I might try
here.
Our website works correctly for 99.9% of customers, however we have one set
of customers who...
|
by: What-a-Tool |
last post by:
I'm playing around in my personal site trying to figure out a way to detect
if JavaScript is enabled client side, and get that info back to the server
without any manual intervention, or visibility...
|
by: Matt Kruse |
last post by:
http://www.JavascriptToolbox.com/bestpractices/
I started writing this up as a guide for some people who were looking for
general tips on how to do things the 'right way' with Javascript. Their...
|
by: oreng |
last post by:
Hey all,
I have some problems detecting whether the client's browser javascript
is enabled at the server side.
While Request.Browser.JavaScript only check if the browser enable java
script (and...
|
by: Bredahl jensen |
last post by:
Most of the the solution i have seen was throught javascript.
Many thanks in advance
JB
|
by: trpost |
last post by:
I am looking for a script using javascript to pull browser information
including, browser type and version, OS info, plugins (flash, acrobat,
media player, etc), java version, etc. that will work...
|
by: Jeremy Chapman |
last post by:
Is there any way via server side code to determine if the browser supports
javascript?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |