check browser from server side programming

A

Anshul

How can I check the current working browser from server side scripting
or from HTML other than javascript. Can any body help.

I dont want to use javascript to check the current working browser.

Thanks
 
D

David Dorward

How can I check the current working browser from server side scripting
or from HTML other than javascript. Can any body help.

Why are you asking how to do something using any technique other then
JavaScript ... in a newsgroup about JavaScript?!

And check the browser for what?
 
A

Anshul

Why are you asking how to do something using any technique other then
JavaScript ... in a newsgroup about JavaScript?!

And check the browser for what?

I need that as mozilla has option to disable javascript. If someone
disable javascript then too the site should go on to some extent hence
I I could get the solution it will be very greatful.

Thanks
 
J

Jani Tiainen

Anshul kirjoitti:
I need that as mozilla has option to disable javascript. If someone
disable javascript then too the site should go on to some extent hence
I I could get the solution it will be very greatful.

All major browsers have ability to disable Javascript, IE6/7, Mozilla
based ones, Opera etc.

There is not any realiable way to detect browser version, not in client
nor server side. Client side is usually made with JS and querying know
features or absence of them. On server side there nothing much to do.
HTTP headers (user agent string) might, or might not contain something
usable, but it's not reliable and out of scope in this NG...

Why just not to stick with very much reliable <noscript></noscript>
method and post nice message to end user to enable JS or switch to
browser that supports JS?
 
D

Dag Sunde

Anshul said:
I need that as mozilla has option to disable javascript. If someone
disable javascript then too the site should go on to some extent hence
I I could get the solution it will be very greatful.

Almost all browsers have the option to disable JavaScript!

You can use the HTTP-Header 'HTTP_USER_AGENT'.

Here's how it's done in PHP:

<?php
echo $_SERVER['HTTP_USER_AGENT'] . "<br /><br />";
$browser = get_browser(null,true);
print_r($browser);
?>

Other Serverside technologies will have different syntax...

HTH...
 
T

Thomas 'PointedEars' Lahn

Anshul said:
[Full quote]
http://www.netmeister.org/news/learn2quote.html

I need that as mozilla has option to disable javascript.

IE, Opera and a number of other UAs have that option, too.

If someone
disable javascript then too the site should go on [...]

Yes, it should. You should therefore learn more about HTML, and how it
intrinsically allows Web documents to be downwards compatible. For the
most simple example:

<a href="foo" onclick="return !window.open(this.href, new
Date().getTime(), 'scrollbars,resizable');">...</a>


PointedEars
 
P

Peter Michaux

How can I check the current working browser from server side scripting
or from HTML other than javascript. Can any body help.

I dont want to use javascript to check the current working browser.

Thanks

Go to gmail with JavaScript disabled and have a look at their
"branching" page that looks at browser capabilities and decides to
which site a user should be redirected.

Peter
 
D

David Mark

Just as a point of curiousity, how?

I can think of ways to override the User-Agent, and even some ways to
interact with the page. I cannot however think of one way to get that page
to display "yes" on a non-Opera browser.

javascript:window.opera = true; alert(window.opera); isn't quite the same
thing.

It will be proved wrong the day the makers of a new agent decide they
want to spoof Opera and implement a global opera object. These sorts
of "rules" were made to be broken.
 
T

Thomas 'PointedEars' Lahn

David said:
Rik [...] wrote [...]:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Dag Sunde wrote:
You can use the HTTP-Header 'HTTP_USER_AGENT'.
http://pointedears.de/scripts/test/whatami
window.opera yes object Opera browser -- prove me wrong!
Damn! :p
(allthough, this too is overridable..)
Just as a point of curiousity, how?

I can think of ways to override the User-Agent, and even some ways to
interact with the page. I cannot however think of one way to get that page
to display "yes" on a non-Opera browser.

javascript:window.opera = true; alert(window.opera); isn't quite the same
thing.

It will be proved wrong the day the makers of a new agent decide they
want to spoof Opera and implement a global opera object. These sorts
of "rules" were made to be broken.

Which is why I created the tests in the first place: to show that the
existence of an object alone does not mean anything about the user agent
or the object model it supports.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top