Solved

Determine which browser IE or Netscape

Posted on 1998-11-20
14
247 Views
Last Modified: 2013-12-25
How can I determine the browser that someone is viewing my page with?  Once this is determined, how can I use this to change the page that it is displaying?
0
Comment
Question by:ccreel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +4
14 Comments
 
LVL 1

Expert Comment

by:rajgn
ID: 1856587
Are you using ASP for your scripting?
0
 

Author Comment

by:ccreel
ID: 1856588
No. Right now I am not using anything but basic html.  The reason for this is that netscape and ie are displaying my tables different.  I am trying to line my tables up to a line in the background.  Do you know if the different browsers display the background immage differently?
0
 
LVL 1

Expert Comment

by:rajgn
ID: 1856589
Yes, NS and IE behave differently with table background image. With basis HTML only, you can't get the details of client's browser.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:ccreel
ID: 1856590
What do I need to use?  Can you give me an example?
0
 

Author Comment

by:ccreel
ID: 1856591
Should I use JavaScript or something else?
0
 
LVL 1

Expert Comment

by:rajgn
ID: 1856592
You can use Client side Javascript for Identifying the browser type and version, but in that case you've to create your HTML page dynamically. i.e After checking the browser capabilities, you've to use document.write(or writeln) methods to write the appropriate HTML into the current document. If you use server side scripting, you can post the HTML accordingly and need not create HTML on the fly. If you want, just try embed the following code snippet in you HEAD tag of a HTML and see.

<script>
if(navigator.appName == "Netscape")
{ document.write("Netscape specific page!!!"); }
else
{ document.write("IE specific page(may be)!!!"); }
</script>

View this page in both IE and NS. You can see the result. You've to follow the same method if you want to use client side scripting only.
0
 

Expert Comment

by:Vitenka
ID: 1856593
You could always use that to produce a redirect page - and direct the user to a different copy of your site - depending on which browser you detect.

Or, you could create a page which looks equally good in all browsers?

0
 
LVL 1

Expert Comment

by:rajgn
ID: 1856594
Vitenka:

As you said, Redirection might be another good option to avoid creating document on the fly.

Well, regarding your last comment, You can always create a page which looks equally good in all browsers but with limited styles, interactivity. If you want to use new features like DHTML(which tend to be browser specific), you must take care of the browser the user is using.
0
 
LVL 8

Expert Comment

by:MaDdUCK
ID: 1856595
check out the code of http://www.madduck.ml.org/index.html.

I am doing exactly this in the last third of the page.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1856596
I use Astound Dynamite to create non-browser specific DHTML pages (well actually it deals with the browser issue).  I like this quite a lot.  Knowing some HTML helps too, as I like to tweak the files...

http://www.beyond.com/AF11804/PKSN100114/prod.htm
0
 
LVL 12

Expert Comment

by:Otta
ID: 1856597
If you are going to use code like:

<script>
if(navigator.appName == "Netscape")
 { document.write("Netscape specific page!!!"); }
else
 { document.write("IE specific page(may be)!!!"); }
</script>

note that any browser which does not support the
tags <script> and </script> will display the Java code
as "text" on the page.

So, use:


<script>
<! -- Start of HTML comment
if(navigator.appName == "Netscape")
 { document.write("Netscape specific page!!!"); }
else
 { document.write("IE specific page(may be)!!!"); }
// Java comment, and end of HTML comment -- >
</script>

so that the Java code is "hidden" between the '<!' and '>' tags,
and thus, does not display at all.
0
 
LVL 12

Expert Comment

by:Otta
ID: 1856598
See the PAQ (Previously Answered Question):

http://www.experts-exchange.com/topics/bin/Q.10068892


0
 

Author Comment

by:ccreel
ID: 1856599
Rajgn and Otta,  Both off your comments were correct.  Please submit an answer so I can accept it and close this question.  
0
 

Accepted Solution

by:
russo earned 20 total points
ID: 1856600
Hi
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question