Re: [PHP] Javascript detection

2011-04-28 Thread Geoff Lane
On Thursday, April 28, 2011, Ashley Sheridan wrote:

> I'm not sure if my earlier reply got through, but here it is again (or
> at least the general gist of it)

Many thanks. I got your info the first time around but didn't respond
directly to you as Tedd made similar comments and I'd responded to his
post.

> Like everyone has mentioned thus far, it's better to use progressive
> enhancement or try to avoid relying on Javascript at all. Even a website
> as complex as Facebook allows users to go on it without needing a
> browser that runs Javascript. Something as complex as Google Docs has a
> very clear need for Javascript though, so you wouldn't expect that to
> work without it.

In my case, one of the controls I'm considering is a tiled map with up
to 16 tiles. This is on a page with four tabbed sections that takes
several seconds to load at broadband speeds. Also, the nature of the
site means that people may need to access it and use this form while
connected via mobile broadband or even GSM; connection media that are
usually both slow and paid for per unit of data transfer. I need to
record in hidden input fields the location of where a user clicks on
the map and also echo that click back in the form of a marker overlaid
on the clicked tile. Using AJAX, I can update just the two fields plus
one image. Without Javascript, the extra bandwidth needed to
unnecessarily download the entire page multiple times will cost my
users both time and money. So while I must ensure the site works
without Javascript, I really need the optimisation that JS brings.

> Lastly, if you're creating the website for a government or business, you
> really need to make it work without Javascript, as a lot of countries
> make it illegal to discriminate against a disability, which you would be
> doing if you made a site that was unusable without Javascript. After
> all, there are many speech and Braille browsers out there that can't
> take advantage of Javascript, and a lot of Javascript apps which require
> mouse interaction to run (mouseover/hover events, etc)

AIUI, a lot of countries (mine included) make it unlawful to knowingly
discriminate against the disabled. However, The Disability
Discrimination Act requires only that reasonable steps be taken to
avoid discrimination ... and making stuff accessible to the disabled
at considerable inconvenience and/or expense to everyone else is not
considered reasonable. Now where I can, I'll produce stuff that is
enhanced by images, colour, JS etc. but will still be usable in Lynx.
However, some stuff (e.g. mapping) won't work without graphics and so
is inherently unavailable to the visually impaired. It makes no sense
whatever to try to make such content work in speech and Braille
browsers. Thus making a site that's unusable without Javascript
doesn't necessarily constitute unlawful discrimination!

-- 
Geoff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection

2011-04-28 Thread Ashley Sheridan
On Thu, 2011-04-28 at 10:17 -0400, tedd wrote:

> At 9:02 AM +0100 4/28/11, Geoff Lane wrote:
> >
> >FWIW, it's possible to detect whether or not Javascript is available,
> >but not AFAICT at 'first contact' because you need the 'first contact'
> >page to do something to prove that JS is available, from which you can
> >assume that JS is not should that something not be done. For example,
> >you can make the link to a page into a form submission - e.g:
> >
> >   
> >   
> >   
> >>onClick="document.forms['jstest'].submit();return(false);">
> >   Click Here
> >
> >The form is submitted if the browser has JS and so the hidden input
> >field is posted. However, if the browser doesn't have JS the default
> >behaviour occurs when the link is clicked and so the field is not
> >posted. Hence we can use isset($_POST['wehavejs']) to determine
> >whether or not the browser has JS capability.
> >
> >Thanks again,
> >
> >--
> >Geoff
> 
> Geoff:
> 
> You are correct about "first contact" -- you need to launch the 
> browser to check to see if the browser has javascript enabled. 
> There's currently no way for the server to see what the user has 
> selected for their browser before the browser launches.
> 
> It is true that the $_SERVER global provides all sorts of information 
> about the requester and I suppose it could also contain the browser's 
> javascript configuration, but it doesn't.
> 
> However, JavaScript detection doesn't require a user's response, as 
> you have proposed via a form.
> 
> Instead, you can simply add an "onload()" operation to the page and 
> detect javascript, such as:
> 
> http://www.webbytedd.com/b1/ajax-js-dection/
> 
> Or do it unobtrusively as I have shown before.
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com/
> 


I'm not sure if my earlier reply got through, but here it is again (or
at least the general gist of it)

There are ways you can detect if a browser is *capable* of running
Javascript using $_SERVER['HTTP_USER_AGENT'] and an up-to-date
browscap.ini file. This will allow you to check if the browser indicated
by the user agent. However, there are caveats to this approach:


  * A browser might be sending the wrong user agent string, there
are plenty of plugins which do this
  * A browser might be capable of running Javascript but might have
it turned off or otherwise blocked
  * Filtering may be going on by a proxy server or firewall that
strips out Javascript (sounds stupid but happens in paranoid
businesses)


Like everyone has mentioned thus far, it's better to use progressive
enhancement or try to avoid relying on Javascript at all. Even a website
as complex as Facebook allows users to go on it without needing a
browser that runs Javascript. Something as complex as Google Docs has a
very clear need for Javascript though, so you wouldn't expect that to
work without it.

Lastly, if you're creating the website for a government or business, you
really need to make it work without Javascript, as a lot of countries
make it illegal to discriminate against a disability, which you would be
doing if you made a site that was unusable without Javascript. After
all, there are many speech and Braille browsers out there that can't
take advantage of Javascript, and a lot of Javascript apps which require
mouse interaction to run (mouseover/hover events, etc)

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Javascript detection

2011-04-28 Thread tedd

At 9:02 AM +0100 4/28/11, Geoff Lane wrote:


FWIW, it's possible to detect whether or not Javascript is available,
but not AFAICT at 'first contact' because you need the 'first contact'
page to do something to prove that JS is available, from which you can
assume that JS is not should that something not be done. For example,
you can make the link to a page into a form submission - e.g:

  
  
  
  onClick="document.forms['jstest'].submit();return(false);">

  Click Here

The form is submitted if the browser has JS and so the hidden input
field is posted. However, if the browser doesn't have JS the default
behaviour occurs when the link is clicked and so the field is not
posted. Hence we can use isset($_POST['wehavejs']) to determine
whether or not the browser has JS capability.

Thanks again,

--
Geoff


Geoff:

You are correct about "first contact" -- you need to launch the 
browser to check to see if the browser has javascript enabled. 
There's currently no way for the server to see what the user has 
selected for their browser before the browser launches.


It is true that the $_SERVER global provides all sorts of information 
about the requester and I suppose it could also contain the browser's 
javascript configuration, but it doesn't.


However, JavaScript detection doesn't require a user's response, as 
you have proposed via a form.


Instead, you can simply add an "onload()" operation to the page and 
detect javascript, such as:


http://www.webbytedd.com/b1/ajax-js-dection/

Or do it unobtrusively as I have shown before.

Cheers,

tedd


--
---
http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection

2011-04-28 Thread Per Jessen
tedd wrote:

> As Yogi Berra once said; "It's always hard to predict things
> especially when it deals with the future."
> 

He was quoting Niels Bohr:

http://www.quotationspage.com/quote/26159.html



-- 
Per Jessen, Zürich (10.2°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection

2011-04-28 Thread Geoff Lane
 On Thursday, April 28, 2011, tedd wrote:
 
> To answer your question in a new thread.

> No, the $_SERVER super-global isn't going to give you anything nor is 
> anything else like it.

> You see, PHP has a difficult time detecting IF Javascript is turned 
> ON in the client's browser because PHP is history by the time the 
> browser does anything, including running Javascript.

Thanks, Tedd. That's how I suspected things to be. However, the list
was very quiet, I might have missed something, and so I felt it
couldn't hurt to ask. TBH I'd already done:

 echo "";
 print_r ($_SERVER);
 echo "";

and didn't spot anything there that I thought would give me the info I
sought - but then I don't know the purpose of every element of that
array and $_SERVER is not the only superglobal!

> As Yogi Berra once said; "It's always hard to predict things 
> especially when it deals with the future."

However, once the browser has requested a transfer via HTTP that
request is in the past and that request is where stuff that lets you
know some of the browser's capabilities (e.g. HTTP_ACCEPT) comes from.
So it would be possible by a similar mechanism for a browser to tell
your script whether or not Javascript (or any other language for that)
is available.

> However, there are two ways to "kind-of" doing it:

> Way 1 --  I place an element in html that is hidden from the user's 
> view via css (display:none) and if Javascript is ON then Javascript 
> changes the css so that the element is shown to the user 
> (display:block). Here's an example:

This is the reverse of part of what I've done for the page in
question. I had a tabbed interface similar to:


[stuff]


[stuff]

...

However, the second div must be visible if JS isn't available
otherwise the user can't access that section. So I've changed the
style of the second and subsequent divs to display:block and then used
an onLoad routine to change the .style.display and .style.visibility
attributes of the second and subsequent divs to none and hidden
respectively so that those who have JS get the full DHTML.

Now I also using AJAX on that page. However, I can use the fact that
the trigger events aren't handled if JS isn't available to just
retrieve what's actually needed at the time via AJAX if JS is
available or submit the full form if it's not. Of course, that
complicates things in the PHP on the server as the script then has to
handle both interim and final form submission.

FWIW, it's possible to detect whether or not Javascript is available,
but not AFAICT at 'first contact' because you need the 'first contact'
page to do something to prove that JS is available, from which you can
assume that JS is not should that something not be done. For example,
you can make the link to a page into a form submission - e.g:

  
  
  
  
  Click Here

The form is submitted if the browser has JS and so the hidden input
field is posted. However, if the browser doesn't have JS the default
behaviour occurs when the link is clicked and so the field is not
posted. Hence we can use isset($_POST['wehavejs']) to determine
whether or not the browser has JS capability.

Thanks again,

-- 
Geoff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-13 Thread Casey Chu

That book is so cool! =P

Anyways, it said that browsers with Javascript, but not a recent
enough Javascript would not display the Noscript.

On 1/13/07, tedd <[EMAIL PROTECTED]> wrote:

At 9:32 PM -0800 1/11/07, Jürgen Wind wrote:
>tedd wrote:
>>index.php, jstest110.php) , make it one.
>ok
>---8<---
>>It would be cool if I could send js value via a
>>POST instead of GET-- can that be done?
>have a look http://149.222.235.16/jstest/70112/index.php ( POST version )
>
>>tedd
>
>>PS: I read somewhere that using  is not recommended.
>any info?

Yes, I knew I read it somewhere (my memory is not as good as it used to be).

In the book "PPK on Javascript" (most excellent
book btw http://www.quirksmode.org/book/), on
page 57 he says "Therefore, it's best not to use
the  tag at all."

I leave it to you to buy the book to find out
why. But basically, browsers that don't use
javascript don't see that tag and those that do,
don't use it. As such, the tag has no real use.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-13 Thread tedd

At 9:32 PM -0800 1/11/07, Jürgen Wind wrote:

tedd wrote:

index.php, jstest110.php) , make it one.

ok
---8<---

It would be cool if I could send js value via a
POST instead of GET-- can that be done?

have a look http://149.222.235.16/jstest/70112/index.php ( POST version )


tedd



PS: I read somewhere that using  is not recommended.

any info?


Yes, I knew I read it somewhere (my memory is not as good as it used to be).

In the book "PPK on Javascript" (most excellent 
book btw http://www.quirksmode.org/book/), on 
page 57 he says "Therefore, it's best not to use 
the  tag at all."


I leave it to you to buy the book to find out 
why. But basically, browsers that don't use 
javascript don't see that tag and those that do, 
don't use it. As such, the tag has no real use.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-12 Thread Jürgen Wind


Ruben Rubio Rey wrote:
> 
> A good way to detect if javascript exists is (cross-browser,
> cross-platform):
> 
> You try to load javascript_exists.htm.
> 
> - 
> javascript_exists.htm:
> 
> 
> 
> 
>  ...
> Javascript is actived!!
> 
> 
> - 
> javascript_not_actived.htm:
> 
>  ...
> Javascript is *NOT* actived!!
> 
> 
obviously the most simple and logical solution ;)

p.s.:
sorry for the previous empty post(hit wrong botten)
Juergen

-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8297234
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-12 Thread Jürgen Wind



Ruben Rubio Rey wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> A good way to detect if javascript exists is (cross-browser,
> cross-platform):
> 
> You try to load javascript_exists.htm.
> 
> - 
> javascript_exists.htm:
> 
> 
> 
> 
>  ...
> Javascript is actived!!
> 
> 
> - 
> javascript_not_actived.htm:
> 
>  ...
> Javascript is *NOT* actived!!
> 
> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFFpzemIo1XmbAXRboRAirXAKCo8LlqI0gv/7+Kfs7L6EHJGRdN3QCgo530
> 1YwBznS0B8p3KSFVCVcyyfc=
> =DjZ8
> -END PGP SIGNATURE-
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8297155
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-11 Thread Ruben Rubio
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

A good way to detect if javascript exists is (cross-browser,
cross-platform):

You try to load javascript_exists.htm.

- 
javascript_exists.htm:




 ...
Javascript is actived!!


- 
javascript_not_actived.htm:

 ...
Javascript is *NOT* actived!!


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpzemIo1XmbAXRboRAirXAKCo8LlqI0gv/7+Kfs7L6EHJGRdN3QCgo530
1YwBznS0B8p3KSFVCVcyyfc=
=DjZ8
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-11 Thread Jürgen Wind

tedd wrote:
>index.php, jstest110.php) , make it one.
ok
---8<---
>It would be cool if I could send js value via a 
>POST instead of GET-- can that be done?
have a look http://149.222.235.16/jstest/70112/index.php ( POST version )

>tedd

>PS: I read somewhere that using  is not recommended.
any info?

have fun,
Jürgen

-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8292741
Sent from the PHP - General mailing list archive at Nabble.com.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-10 Thread Jürgen Wind

>index.php, jstest110.php) , make it one.
no, it was just a proof of concept

>It would be cool if I could send js value via a 
>POST instead of GET-- can that be done?
should be possible with some onload/xhtmlrequest

>tedd

>PS: I read somewhere that using  is not recommended.
hmm, any links or buzzwords for google?
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8267553
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

2007-01-10 Thread tedd

At 4:54 AM -0800 1/10/07, Jürgen Wind wrote:

8< [source of index]

 
 




Nice -- now instead of two different pages (i.e., 
index.php, jstest110.php) , make it one.


Here's my solution:  

echo("type='text/javascript'>location.href='index.php?js=ok';"); 


}
else
{
$js  = $_GET['js'];
if($js != "ok")
{
$js = "no";
}
}
?>

Now, depending upon the value of $js, do whatever.

It would be cool if I could send js value via a 
POST instead of GET-- can that be done?


tedd

PS: I read somewhere that using  is not recommended.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version



Curt Zirzow-2 wrote:
> 
> On 1/1/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
>>
>> well,
>> no cute css, but (hopefully) working - here is my quick & dirty version :
>>
>> http://149.222.235.16/public/
> 
> I dont understand the point.
> 
> Curt,
> 

sorry, i should have posted the original code (it's merely js/html/browser
related, not php)

http://149.222.235.16/public/index.html (20070102) :






as i already said elsewhere in the thread: it was just a quick&dirty hack,
as tedds link didn't work. 
But Roman made a good point:
>Out of curiosity, can you guarantee the Javascript redirect will always
>occur before the meta redirect when Javascript is enabled? Otherwise you
>have a race condition.

so here is what's new in http://149.222.235.16/public/index.php (20070110) :

8<

 
 


-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8256985
Sent from the PHP - General mailing list archive at Nabble.com.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


On 1/1/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:


well,
no cute css, but (hopefully) working - here is my quick & dirty version :

http://149.222.235.16/public/


I dont understand the point.

Curt,

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


you additionaly can surround the meta redirect with noscript tags:
 
<!--// index.html 
D=new Date() 
location.href='jstest.php?js=ok&t='+D.getTimezoneOffset() 
//--> 
 
  



tedd wrote:
> 
> At 9:55 PM +0100 1/2/07, Satyam wrote:
>>- Original Message - From: "Robert Cummings"
<[EMAIL PROTECTED]>
>>To: "Jürgen Wind" <[EMAIL PROTECTED]>
>>Cc: 
>>Sent: Tuesday, January 02, 2007 8:57 PM
>>Subject: Re: [PHP] Javascript detection , working version
>>
>>>On Tue, 2007-01-02 at 11:32 -0800, Jürgen Wind wrote:
>>>>Robert Cummings wrote:
>>>>>
>>>>>  Out of curiosity, can you guarantee the Javascript redirect will
>>>>> always
>>>>>  occur before the meta redirect when Javascript is enabled? Otherwise
>>>>> > you
>>>>>  have a race condition.
>>>>>
>>>>>  Cheers,
>>>>>  Rob.
>>>>>
>>>>i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
>>>>the js part is rather fast, maybe a little delay or window.write is
>>>>neccessary after the redirect?
>>>
>>>No, you always want the javascript to run first. The question is whether
>>>a meta redirect could ever occur before the javascript redirect. If it
>>>can then occasionally you may get "javascript not detected" since the
>>>meta redirect would occur when in fact javascript is enabled.
>>>
>>>Cheers,
>>>Rob.
>>>--
>>
>>What I usually do is to make the entry page the 
>>one that would be used without JavaScript and 
>>branch only if JavaScript is present.
>>
>>Satyam
> 
> To all:
> 
> What I am doing is not branching to any other 
> page but rather if js is present then I use the 
> js enhancement and if not, then it's not there to 
> be used. In either case, the page works. It's 
> only an enhancement. In either case, there's no 
> race condition.
> 
> tedd
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8250856
Sent from the PHP - General mailing list archive at Nabble.com.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


At 9:55 PM +0100 1/2/07, Satyam wrote:

- Original Message - From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Jürgen Wind" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, January 02, 2007 8:57 PM
Subject: Re: [PHP] Javascript detection , working version


On Tue, 2007-01-02 at 11:32 -0800, Jürgen Wind wrote:

Robert Cummings wrote:


 Out of curiosity, can you guarantee the Javascript redirect will always
 occur before the meta redirect when Javascript is enabled? Otherwise > you
 have a race condition.

 Cheers,
 Rob.


i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
the js part is rather fast, maybe a little delay or window.write is
neccessary after the redirect?


No, you always want the javascript to run first. The question is whether
a meta redirect could ever occur before the javascript redirect. If it
can then occasionally you may get "javascript not detected" since the
meta redirect would occur when in fact javascript is enabled.

Cheers,
Rob.
--


What I usually do is to make the entry page the 
one that would be used without JavaScript and 
branch only if JavaScript is present.


Satyam


To all:

What I am doing is not branching to any other 
page but rather if js is present then I use the 
js enhancement and if not, then it's not there to 
be used. In either case, the page works. It's 
only an enhancement. In either case, there's no 
race condition.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


that's why i prefer discussing here in the forum, we benefit from the
experiences of each other :)
updated version: http://149.222.235.16/jstest/
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8132203
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version




Robert Cummings wrote:
> 
> Out of curiosity, can you guarantee the Javascript redirect will always
> occur before the meta redirect when Javascript is enabled? Otherwise you
> have a race condition.
> 
> Cheers,
> Rob.
> 
yes, you where right (i noticed some problems with opera)
updated version: http://149.222.235.16/jstest/
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8132150
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version




Satyam wrote:
> 
> 
> What I usually do is to make the entry page the one that would be used 
> without JavaScript and branch only if JavaScript is present.
> 
> Satyam
> 

yes, that's the best solution, updated version:
http://149.222.235.16/jstest/
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8132106
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version



- Original Message - 
From: "Robert Cummings" <[EMAIL PROTECTED]>


What I usually do is to make the entry page the one that would be used 
without JavaScript and branch only if JavaScript is present.


Yeah, that was what I did :)

Cheers,
Rob.
--


Sorry, it seems I missed it.

Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


At 3:39 PM -0500 1/2/07, Robert Cummings wrote:

On Tue, 2007-01-02 at 15:24 -0500, tedd wrote:

 Rob:

 That's a good point -- even if a delay was added
 it's not certain that it wouldn't experience a
 race issue. And the longer the delay, the more
 problems you have with the user experience.

 Perhaps a token scheme, like prohibiting
 duplicate from submissions, might work.


Well I don't know if there is a race condition. I don't know enough
about meta redirects and javascript execution to know if a race
condition exists at all. That was why I did my solution the way I did
it, I know for a fact there is no race condition in it :)

Cheers,
Rob.


Rob:

I haven't had a chance to check out your solution, but I will.

Many thanks.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

On Tue, 2007-01-02 at 21:55 +0100, Satyam wrote:
> - Original Message - 
> From: "Robert Cummings" <[EMAIL PROTECTED]>
> To: "Jürgen Wind" <[EMAIL PROTECTED]>
> Cc: 
> Sent: Tuesday, January 02, 2007 8:57 PM
> Subject: Re: [PHP] Javascript detection , working version
> 
> 
> > On Tue, 2007-01-02 at 11:32 -0800, Jürgen Wind wrote:
> >> Robert Cummings wrote:
> >> >
> >> > Out of curiosity, can you guarantee the Javascript redirect will always
> >> > occur before the meta redirect when Javascript is enabled? Otherwise 
> >> > you
> >> > have a race condition.
> >> >
> >> > Cheers,
> >> > Rob.
> >> >
> >> i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
> >> the js part is rather fast, maybe a little delay or window.write is
> >> neccessary after the redirect?
> >
> > No, you always want the javascript to run first. The question is whether
> > a meta redirect could ever occur before the javascript redirect. If it
> > can then occasionally you may get "javascript not detected" since the
> > meta redirect would occur when in fact javascript is enabled.
> >
> > Cheers,
> > Rob.
> > -- 
> 
> What I usually do is to make the entry page the one that would be used 
> without JavaScript and branch only if JavaScript is present.

Yeah, that was what I did :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version



- Original Message - 
From: "Robert Cummings" <[EMAIL PROTECTED]>

To: "Jürgen Wind" <[EMAIL PROTECTED]>
Cc: 
Sent: Tuesday, January 02, 2007 8:57 PM
Subject: Re: [PHP] Javascript detection , working version



On Tue, 2007-01-02 at 11:32 -0800, Jürgen Wind wrote:

Robert Cummings wrote:
>
> Out of curiosity, can you guarantee the Javascript redirect will always
> occur before the meta redirect when Javascript is enabled? Otherwise 
> you

> have a race condition.
>
> Cheers,
> Rob.
>
i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
the js part is rather fast, maybe a little delay or window.write is
neccessary after the redirect?


No, you always want the javascript to run first. The question is whether
a meta redirect could ever occur before the javascript redirect. If it
can then occasionally you may get "javascript not detected" since the
meta redirect would occur when in fact javascript is enabled.

Cheers,
Rob.
--


What I usually do is to make the entry page the one that would be used 
without JavaScript and branch only if JavaScript is present.


Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

On Tue, 2007-01-02 at 15:24 -0500, tedd wrote:
> Rob:
> 
> That's a good point -- even if a delay was added 
> it's not certain that it wouldn't experience a 
> race issue. And the longer the delay, the more 
> problems you have with the user experience.
> 
> Perhaps a token scheme, like prohibiting 
> duplicate from submissions, might work.

Well I don't know if there is a race condition. I don't know enough
about meta redirects and javascript execution to know if a race
condition exists at all. That was why I did my solution the way I did
it, I know for a fact there is no race condition in it :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


At 2:06 PM -0500 1/2/07, Robert Cummings wrote:

On Tue, 2007-01-02 at 10:06 -0800, Jürgen Wind wrote:

 tedd, plz no personal mail, i like better to discuss things in the forum and
 thus hear other meanings and experiences.
 >Your solution was very simple and worked very well.
 tx, i always  try to keep things logical and as simple as possible ;)
 this is just a quick example to show how to bring info gathered by js back
 to the php application (and possibly store it in a session for later use).
 Using the query string is just one way and can also be used in combination
 with loading some css.php or some such. Setting a cookie may be another
 option.
 Happy coding ;)


Out of curiosity, can you guarantee the Javascript redirect will always
occur before the meta redirect when Javascript is enabled? Otherwise you
have a race condition.

Cheers,
Rob.


Rob:

That's a good point -- even if a delay was added 
it's not certain that it wouldn't experience a 
race issue. And the longer the delay, the more 
problems you have with the user experience.


Perhaps a token scheme, like prohibiting 
duplicate from submissions, might work.


tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

On Tue, 2007-01-02 at 11:32 -0800, Jürgen Wind wrote:
> Robert Cummings wrote:
> > 
> > Out of curiosity, can you guarantee the Javascript redirect will always
> > occur before the meta redirect when Javascript is enabled? Otherwise you
> > have a race condition.
> > 
> > Cheers,
> > Rob.
> > 
> i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
> the js part is rather fast, maybe a little delay or window.write is
> neccessary after the redirect?

No, you always want the javascript to run first. The question is whether
a meta redirect could ever occur before the javascript redirect. If it
can then occasionally you may get "javascript not detected" since the
meta redirect would occur when in fact javascript is enabled.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version




Robert Cummings wrote:
> 
> Out of curiosity, can you guarantee the Javascript redirect will always
> occur before the meta redirect when Javascript is enabled? Otherwise you
> have a race condition.
> 
> Cheers,
> Rob.
> 
i have no idea, it is just a quick&dirty  hack, i'm no js expert ;)
the js part is rather fast, maybe a little delay or window.write is
neccessary after the redirect?
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8129234
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version

On Tue, 2007-01-02 at 10:06 -0800, Jürgen Wind wrote:
> tedd, plz no personal mail, i like better to discuss things in the forum and
> thus hear other meanings and experiences.
> >Your solution was very simple and worked very well.
> tx, i always  try to keep things logical and as simple as possible ;)
> this is just a quick example to show how to bring info gathered by js back
> to the php application (and possibly store it in a session for later use).
> Using the query string is just one way and can also be used in combination
> with loading some css.php or some such. Setting a cookie may be another
> option.
> Happy coding ;)

Out of curiosity, can you guarantee the Javascript redirect will always
occur before the meta redirect when Javascript is enabled? Otherwise you
have a race condition.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


tedd, plz no personal mail, i like better to discuss things in the forum and
thus hear other meanings and experiences.
>Your solution was very simple and worked very well.
tx, i always  try to keep things logical and as simple as possible ;)
this is just a quick example to show how to bring info gathered by js back
to the php application (and possibly store it in a session for later use).
Using the query string is just one way and can also be used in combination
with loading some css.php or some such. Setting a cookie may be another
option.
Happy coding ;)
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8127911
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


At 4:54 PM -0800 1/1/07, =?UTF-8?Q?J=C3=BCrgen_Wind?= wrote:

well,
no cute css, but (hopefully) working - here is my quick & dirty version :

http://149.222.235.16/public/
--



Well, it's cute enough for me !  It works on every browser that 
BrowserCam has -- hell, I can't even get my web site to do that.


Much thanks.

tedd

PS: Too bad my email doesn't translate your name right.

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection , working version


well,
no cute css, but (hopefully) working - here is my quick & dirty version : 

http://149.222.235.16/public/
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8118787
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection

On Mon, 2007-01-01 at 16:14 -0500, tedd wrote:
> Hi gang:
> 
> I've asked this request on a couple of other list, but considering 
> that I've done this with a mixture of php and javascript, perhaps 
> some of you might check this out for me.
> 
> Try this:
> 
> http://sperling.com/js_detect
> 
> Does this technique work to detect your browser's javascript setting?
> 
> Also, if you change your browser's javascript setting, please restart 
> your browser before rechecking the link.
> 
> If this works well enough, I'll post the code.

It doesn't seem to be working for anyone (me neither btw)... why not use
a simpler approach? Here's an example that doesn't use a redirect. Due
to using the onload mechanism we can be certain that the order of the
updates to the session occurs in expected order (if javascript is
enabled) which is as we want.

Feel free to use as you please...




  





Javascript NOT detected!








Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection


does not work on SeaMonkey and Opera (IE not tested).
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8117266
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Javascript detection

I do have javascript enabled, but it does not detect it...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 01, 2007 11:14 PM
To: php-general@lists.php.net
Subject: [PHP] Javascript detection

Hi gang:

I've asked this request on a couple of other list, but considering 
that I've done this with a mixture of php and javascript, perhaps 
some of you might check this out for me.

Try this:

http://sperling.com/js_detect

Does this technique work to detect your browser's javascript setting?

Also, if you change your browser's javascript setting, please restart 
your browser before rechecking the link.

If this works well enough, I'll post the code.

Thanks.

tedd

PS: I wrote this simply because I couldn't find an acceptable PHP 
"Javascript detection" solution. If anyone knows of something better, 
please let me know.
-- 
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript detection


On Mon, 1 Jan 2007 16:14:06 -0500, tedd <[EMAIL PROTECTED]> wrote:
> Does this technique work to detect your browser's javascript setting?

Not for me, it says "Javascript has not been detected on the client." when in 
fact I've got JavaScript enabled (Firefox 1.5.0.8 on Ubuntu Linux).

Paul

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php