logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
Journals
Folklore and Mythology
Business Coach
Marriage
Senior Living
Ethnic Beauty
Adolescence


dailyclick
All times in EST

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

Browser-Specific Code for IE and Netscape
Guest Author - Lisa Shea

If you are designing a website, it is critical that you understand the differences between IE - Internet Explorer - and Netscape, and code for both.

The first thing you need to do is figure out what type of browser your visitor is using. You would do that with this code:

Dim SvrVar
Set SvrVar = Request.ServerVariables
BrowserName = SvrVar("HTTP_USER_AGENT")
OpSys = SvrVar("HTTP_UA_OS")
Set SvrVar = Nothing

Now you know exactly what browser and what operating system your user is using. Next, you would set up a separate style sheet for each browser. Different browsers use different stylesheet commands - and different operating systems use different fonts. Here would be a way to handle the four main combinations:

'SHOW STYLESHEET FOR MATCHING SYSTEM'
if InStr(BrowserName, "MSIE") > 0 and InStr(BrowserName, "Win") > 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") > 0 and InStr(BrowserName, "Win") = 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") > 0 then
Response.Write ""
end if
if InStr(BrowserName, "MSIE") = 0 and InStr(BrowserName, "Win") = 0 then
Response.Write ""
end if

That takes care of the basics. Let's now get on to the actual page construction. One big difference between IE and Netscape is that IE uses body parameters of "topmargin" and "leftmargin", while Netscape goes with "marginheight" and "marginwidth". So your code to write your body statement could look like this:

if InStr(BrowserName, "MSIE") > 0 then
Response.Write ""
else
Response.Write ""
end if

You would use this same logic all through your code, making sure to write it appropriately based on what browser and operating system your user was working with. Yes, much of HTML is understood by all browsers, but you want your website to look at perfect as possible in all conditions. It is your responsibility as a developer to test your code on IE and Netscape, on PCs and Macs, to understand what the world sees when they view your website!

This site needs an editor - click to learn more!

RSS | Related Articles | Previous Features | Site Map

Add Browser%2DSpecific+Code+for+IE+and+Netscape to Twitter Add Browser%2DSpecific+Code+for+IE+and+Netscape to Facebook Add Browser%2DSpecific+Code+for+IE+and+Netscape to MySpace Add Browser%2DSpecific+Code+for+IE+and+Netscape to Del.icio.us Digg Browser%2DSpecific+Code+for+IE+and+Netscape Add Browser%2DSpecific+Code+for+IE+and+Netscape to Yahoo My Web Add Browser%2DSpecific+Code+for+IE+and+Netscape to Google Bookmarks Add Browser%2DSpecific+Code+for+IE+and+Netscape to Stumbleupon Add Browser%2DSpecific+Code+for+IE+and+Netscape to Reddit


Content copyright © 2009 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter

jobs
what
job title, keywords
where
city, state or zip
jobs by job search


vote
Growing a Garden
Veggies and Flowers
Veggies Only
Flowers Only
No Garden

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2009 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor