473,725 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check if browser is NOT I.E.

On a page optimised for IE, I'd like to check if the browser type is other
than IE, so I can direct them to another page.

How can I modify the code below to redirect to indextext.asp if they aren't
using IE? I've tried changing the = for <>, but get a syntax error.

Thanks

USER_AGENT = Request.ServerV ariables("HTTP_ USER_AGENT")
IS_IE = InStr(USER_AGEN T,"MSIE")
if IS_IE then
response.redire ct "indextext. asp"
end if
Jul 19 '05 #1
15 8343
"David" <da***@brown666 9.freeserve.co. uk> wrote in message
news:5q******** ******@newsfep3-gui.server.ntli .net...
On a page optimised for IE, I'd like to check if the browser type is other
than IE, so I can direct them to another page.

How can I modify the code below to redirect to indextext.asp if they aren't using IE? I've tried changing the = for <>, but get a syntax error.


I hope this is not for a public website... browser sniffing is bad practice.

Peter Foti
Jul 19 '05 #2
> I hope this is not for a public website... browser sniffing is bad
practice.

Why do you say that?

Bob Lehmann

"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in message
news:10******** *****@corp.supe rnews.com...
"David" <da***@brown666 9.freeserve.co. uk> wrote in message
news:5q******** ******@newsfep3-gui.server.ntli .net...
On a page optimised for IE, I'd like to check if the browser type is other than IE, so I can direct them to another page.

How can I modify the code below to redirect to indextext.asp if they aren't
using IE? I've tried changing the = for <>, but get a syntax error.


I hope this is not for a public website... browser sniffing is bad

practice.
Peter Foti

Jul 19 '05 #3
The code you posted works fine on my machine, what specific syntax error are
you receiving?

"David" <da***@brown666 9.freeserve.co. uk> wrote in message
news:5q******** ******@newsfep3-gui.server.ntli .net...
On a page optimised for IE, I'd like to check if the browser type is other
than IE, so I can direct them to another page.

How can I modify the code below to redirect to indextext.asp if they aren't using IE? I've tried changing the = for <>, but get a syntax error.

Thanks

USER_AGENT = Request.ServerV ariables("HTTP_ USER_AGENT")
IS_IE = InStr(USER_AGEN T,"MSIE")
if IS_IE then
response.redire ct "indextext. asp"
end if

Jul 19 '05 #4
"Bob Lehmann" <none> wrote in message
news:ev******** ********@tk2msf tngp13.phx.gbl. ..
I hope this is not for a public website... browser sniffing is bad

practice.

Why do you say that?


For one, it's unreliable. Some browsers even let you input any user Agent
string you want. It also makes maintenance a nightmare. You are better off
writing semantically correct code that can be displayed in all web browsers.

Regards,
Peter
Jul 19 '05 #5

"Lance Wynn" <la********@N.O .S.P.A.M.hotmai l.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
The code you posted works fine on my machine, what specific syntax error are you receiving?


The code I posted does work for detecting if it's IE - what I want to do is
modify it to redirect the visitor to a different page if they are using a
browser other that IE. If I change the = sign to <> (as below) , the browser
comes up with "Syntax error" and points to the <>.

Other points:- what on earth is "Browser sniffing"? I got the code from this
forum in the first place in answer to a question on how I can direct
visitors to pages optimised for their browser, and that is exactly what I
use the code for. Why on earth is directing visitors to pages designed for
their browser a bad thing????????

Thanks,

David

USER_AGENT = Request.ServerV ariables("HTTP_ USER_AGENT")
IS_IE <> InStr(USER_AGEN T,"MSIE")
if IS_IE then
response.redire ct "indextext. asp"
end if
Jul 19 '05 #6
On Thu, 26 Feb 2004 06:54:18 -0000, David
<da***@brown666 9.freeserve.co. uk> wrote:
The code I posted does work for detecting if it's IE - what I want to do
is modify it to redirect the visitor to a different page if they are
using a
browser other that IE. If I change the = sign to <> (as below) , the
browser comes up with "Syntax error" and points to the <>.
did you mean to do something like this? there are a couple of syntax
errors in the code you pasted.

USER_AGENT = Request.ServerV ariables("HTTP_ USER_AGENT")
IS_IE = InStr(USER_AGEN T,"MSIE")
if IS_IE <> 0 then
response.redire ct "indextext. asp"
end if
Other points:- what on earth is "Browser sniffing"? I got the code from
this forum in the first place in answer to a question on how I can direct
visitors to pages optimised for their browser, and that is exactly what I
use the code for. Why on earth is directing visitors to pages designed
for their browser a bad thing????????


i think it's something of an ideological thing -- it is ALWAYS better to
write universally compatible code rather than code that requires you to
have different pages for different browsers. also, the person whose namei
cant remember pointed out quite rightly that some non-ie browsers, like
opera which i use, can be set to spoof as internet explorer to avoid just
those kinds of mechanisms (if i technically can see a page, i want the
chance to do that, not be sent to a bare-bones version). it more or less
undermines doing browser-sniffing -- checking the user's browser and
coding differently for it -- in the first place.

jenny
Jul 19 '05 #7
"David" wrote:

Why on earth is directing visitors to pages designed for
their browser a bad thing????????


The need to redirect implies a deficiency in your "optimized for IE" page.
This may, as Jenny suggests, be a matter of ideology, but believe me, the
decision to code to standards rather than browsers will pay dividends down
the line.

I personally have no pity for users who access my sites with browsers that
don't understand HTML 4, ECMAScript v3, DOM Level 1 (most of it, anyway) or
CSS 1. Note that these are minima, and I do not DENY anyone on the basis of
his browser. I merely lack respect for his browser choice and make no
attempt to accommodate it. Those standards, after all, are each several
years old.

I partly accommodate those with scripting or cookies turned off, but often
require one or both for users who want to use one of my *applications* with
full functionality.

What does "partly" mean here? One example is popup navigational menus. Our
intranet site has them. But if the scripting to open the menu fails for any
reason (such as crappy browser or scripting turned off), the user is sent to
a page that lists all of the links in the drop-down menu.

Does that user experience the full glory of our navigational menus? Who
cares? Does he get the same opportunity to access information? Yes. And that
is truly the only thing that matters when considering divergence from
standards.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #8
> writing semantically correct code that can be displayed in all web
browsers.
To do that, you would be stuck with HTML 3.2, unless you determined the
browser. Semantically correct code for NS7 may not work in NS4.x.

Bob Lehmann

"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in message
news:10******** *****@corp.supe rnews.com...
"Bob Lehmann" <none> wrote in message
news:ev******** ********@tk2msf tngp13.phx.gbl. ..
I hope this is not for a public website... browser sniffing is bad practice.

Why do you say that?


For one, it's unreliable. Some browsers even let you input any user Agent
string you want. It also makes maintenance a nightmare. You are better

off writing semantically correct code that can be displayed in all web browsers.
Regards,
Peter

Jul 19 '05 #9
"Bob Lehmann" <no****@dontbot herme.zzz> wrote in message
news:ue******** *****@TK2MSFTNG P11.phx.gbl...
writing semantically correct code that can be displayed in all web

browsers.
To do that, you would be stuck with HTML 3.2, unless you determined the
browser. Semantically correct code for NS7 may not work in NS4.x.


Huh?!!! What in the world are you talking about?! Semantically correct
code is far more likely to work in NS4 than not. Can you give me an example
of where this is not true?

The closest I will ever come to browser sniffing is hiding my CSS from NS4
and letting it apply it's default presentation to semantically correct HTML,
since NS4 doesn't properly implement CSS. But this is NOT browser sniffing.

Peter Foti
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3188
by: TG | last post by:
This is more of a pain than I thought it would be. I need a simple code segment to determine whether a browser accepts cookies or not. When I pass variables between pages when cookies are turned off, the global variables are empty between pages, fine, that tells me cookies store the global variables - right? I store the values in $_session and when cookies are turned on values are passed between web pages - I can see these values in fields...
4
1900
by: mike parr | last post by:
I'm trying to do a check to see if the client browser has cookies enabled. But my code below always gives me the value for acceptsCookies = true, whether the machine has cookies enabled or not. Can anybody help me out with this? private void Page_Load(object sender, System.EventArgs e) { if (!(Page.IsPostBack))
5
3175
by: David Baker | last post by:
Hi all I am very new to ASP.Net. I am trying to create a sniffer for our program. We want our users to click our sniffer and hopefully the sniffer will check their computer against our requirements. I would like to ask experts like you to see which items are actually doable with ASP.Net. Below I listed all of the items we are looking for but I can understand if some of the items are impossible to check/sniff. We would like to create a sniffer...
0
904
by: Ayaz | last post by:
Hi All, I need to check the browser (IE) cookie permission, i.e. whether it is possible to create and read a cookie. I need to do that from a VB.NET winform application. For that, I have to create an in-memory cookie, store some value in it and read it back. Could anyone please suggest me a way to do that.
22
2299
by: petermichaux | last post by:
Hi, I would like to display a message to Internet Explorer clients to encorage them to get Firefox. Yes they may like Internet Explorer but it is my site :) http://www.explorerdestroyer.com/ uses navigator.userAgent If ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
6
2409
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am thinking about doing this since I got several cases that some of our internal users open more than one browser at the same time from our server. When one of the transactions was not completed finished, the second browser jusk pick up some session variables from the first browser and process right after that. It messed up everything. I was thinking about use remote_addr, but it seems not working since we are behind the...
11
1763
by: Anshul | last post by:
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
1
4542
by: ilaxi kandoliya | last post by:
Hi, I have developing project with asp.net 2.0 (C#) I have used java script function in my code but if User's browser is java script disable then its not working properly so how to check Browser is java script enable or not and how to restrict user to view java script include page if its browser javascript disable until he not change accordingly. It is urgent Thanks in advance.. Ilaxi
10
3257
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations where you could improve the application by detecting the browser vendor/version. Some of the posters here disagreed. Since then, I've had to deal with a few of these cases; some of them could be rewritten to use object detection, and some couldn't....
11
2069
by: Patrick | last post by:
Trying this question again in a different way and expanding it to another newsgroup. Looking for how I would do this. For an html form; Say I have three check boxes A, B, and C . When I click on a checkbox a dropdown window will open next to it and the selections will be 1, 2, and 3. I want to use the same script and dropdown for each of the 3 check boxes and be able to return values independent of each other. Meaning if I check box A...
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8096
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.