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

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

new
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA


dailyclick
All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Browser-Specific Code for IE and Netscape


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!
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




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


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


Content copyright © 2014 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 Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


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


BellaOnline Editor