Page 1 of 2
can i get browser info?
Posted: Sat Mar 05, 2005 5:10 am
by itsmani1
hi there...
is there any thing is php that can tell browser infomation? like if i want to know that browser has java script support or browser is java script enabled?
Regards!
Posted: Sat Mar 05, 2005 5:26 am
by anjanesh
Max you can get directly is $_SERVER['HTTP_USER_AGENT']
Posted: Sat Mar 05, 2005 7:16 am
by feyd
Posted: Sat Mar 05, 2005 7:25 am
by anjanesh
get_browser :
http://in.php.net/manual/en/function.get-browser.php
I tried this on my host :
Warning: get_browser(): browscap ini directive not set. in /xxx/xxx/getbrowser.php on line 2
Anyway to set it for ourself like the way we do in .htaccess ?
Posted: Sat Mar 05, 2005 9:43 am
by smpdawg
You need to get browscap.ini from a site like this
http://www.garykeith.com/browsers/downloads.asp and set browscap in your php.ini before you can use it.
Posted: Sat Mar 05, 2005 11:24 am
by anjanesh
But we cannot change php.ini on our host.
Posted: Sat Mar 05, 2005 11:35 am
by feyd
ask your host to add it, or make your own version of the function (it isn't hard)
Posted: Mon Mar 07, 2005 7:09 am
by itsmani1
i want to check if browser supports java script and if it does is java script is enabled on it??????
Posted: Mon Mar 07, 2005 7:19 am
by itsmani1
feyd wrote:ask your host to add it, or make your own version of the function (it isn't hard)
what do u mean how can one make his/her own ?
and you make ur own how will u use tht.
Posted: Mon Mar 07, 2005 8:56 am
by Chris Corbyn
Isn't this why most people use <noscript> tags.... it seems the obvious way to output an alternative if JS is disabled, otherwise the JS will just execute if it is enabled... is there a reason you need to do the checking on the server?

Posted: Mon Mar 07, 2005 11:03 am
by feyd
PHP will not be able to detect is JS is enabled; only if the browser has support for it. As d11wtq mentioned, <noscript> is intended for that. You can roll your own version by understanding how the get_browser() function works, which is simple pattern matching. You'll need to use
parse_ini_file() to load the ini.. then flip through it searching for the browser.
Posted: Tue Mar 08, 2005 5:13 am
by itsmani1
what i want to do is :
i want to run timer for 30 minutes on clint side of my page using java script because its very simple using java script.
is there any possibility to do so using php. if there is some thing plz. tell me.
Posted: Tue Mar 08, 2005 5:16 am
by itsmani1
feyd wrote:PHP will not be able to detect is JS is enabled; only if the browser has support for it. As d11wtq mentioned, <noscript> is intended for that. You can roll your own version by understanding how the get_browser() function works, which is simple pattern matching. You'll need to use
parse_ini_file() to load the ini.. then flip through it searching for the browser.
i just want u to tell me how can i know about browser behaviour, that either it supports java script or not and if it does is that enabled or not? if you can tell me pzl. tel
Posted: Tue Mar 08, 2005 6:58 am
by feyd
research the use of <noscript>

Posted: Tue Mar 08, 2005 7:04 am
by itsmani1
oki