Advertisement

03.14.2008 at 06:57PM PDT, ID: 23243539
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Javascript to redirect to browser friendly browser

Zone: JavaScript
Tags: javascript
I can not get this code to work locally.  I want to redirect browser  to one of four available pages by detecting the browser that is reading the code.  Please see code i have in head tag.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
<script type="text/javascript">
<!--
browserName=navigator.appName; 
if ((browserName=="Netscape") ||  (browserName=="opera") ||  (browserName=="firefox"))
{     
 if (browserName=="Netscape")
 window.location="mynetscapepage.html";
   
}
{
 if (browserName=="opera")
    
    window.location="myoperapage.html";
 
}
{
 
if (browserName=="firefox")
    
    window.location="myfirepage.html";
}
 
 
 
else
 
  window.location="myiepage.html";
//-->
</script>
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: greta13
Solution Provided By: b0lsc0tt
Participating Experts: 2
Solution Grade: A
Views: 8
Translate:
Loading Advertisement...
03.14.2008 at 08:22PM PDT, ID: 21131275

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 08:23PM PDT, ID: 21131278

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 08:51PM PDT, ID: 21131366

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 08:52PM PDT, ID: 21131371

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 08:57PM PDT, ID: 21131388

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 09:05PM PDT, ID: 21131402

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.14.2008 at 09:06PM PDT, ID: 21131405

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.16.2008 at 05:23PM PDT, ID: 21139160

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 09:12AM PDT, ID: 21143548

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 10:59AM PDT, ID: 21144525

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 01:06PM PDT, ID: 21145621

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 02:14PM PDT, ID: 21146224

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 02:22PM PDT, ID: 21146293

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 03:58PM PDT, ID: 21147107

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 04:29PM PDT, ID: 21147326

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.17.2008 at 04:37PM PDT, ID: 21147369

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.17.2008 at 01:03AM PDT, ID: 21588354

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.24.2008 at 06:23AM PDT, ID: 21639111

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.14.2008 at 08:22PM PDT, ID: 21131275

Rank: Guru

Why do you want to do browser sniffing? It's a problematic, antiquated practice.

What about other browsers like Safari, Konqueror, and iCab?

By the way, navigator.appName is set to "Netscape" in Firefox. (That's because Firefox and Netscape 6-7 use various versions of the Mozilla Gecko engine.)

Also, it's set to "Opera" in Opera. You are doing a case-sensitive check there.
 
03.14.2008 at 08:23PM PDT, ID: 21131278
I  took care of what i think were some problems in the script but still can not get it to work.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
<script language="JavaScript" 
type="text/JavaScript">
if(navigator.appName == "Firefox")
{
 window.location = "myfirepage.html"
}
 if(navigator.appName == "Netscape")
{
 window.location = "mynetscapepage.html"
}
 if(navigator.appName == "Opera")
{
 window.location = "myoperapage.html"
}
 window.location == "myiepage.html"
</script>
<style type = "text/css">
Open in New Window
 
03.14.2008 at 08:51PM PDT, ID: 21131366

Rank: Genius

greta13,

I really suggest you take a look at some info on the web about browser detection scripts like this before proceeding.

http://www.quirksmode.org/js/support.html
http://www.quirksmode.org/js/detect.html
http://www.quirksmode.org/blog/archives/2006/07/browser_detect.html - (part 2 of the link above updated to be more current)

I'll be happy to answer questions or help but those pages are REALLY worth looking at if you are considering something like this.  There are scripts there you can use too but it may make you rethink this.

Let me know if you have any questions or need more information.

b0lsc0tt
Accepted Solution
 
03.14.2008 at 08:52PM PDT, ID: 21131371

Rank: Genius

greta13,

By the way ... if you use a server script then that may be a better way to do this.  Let us know what server technology or scripts your server supports or you can use.

b0lsc0tt
 
03.14.2008 at 08:57PM PDT, ID: 21131388

Rank: Guru

User-agent sniffing is just as bad with a server-side language as it is with JavaScript.

QuirksMode.org is an excellent resource.

Here are two other similar articles:
http://developer.apple.com/internet/webcontent/objectdetection.html
http://developer.mozilla.org/en/docs/Browser_Detection_and_Cross_Browser_Support
 
03.14.2008 at 09:05PM PDT, ID: 21131402
Thanks i will get back to you in soon here i will check the links
 
03.14.2008 at 09:06PM PDT, ID: 21131405

Rank: Genius

>> User-agent sniffing is just as bad with a server-side language as it is with JavaScript. <<

I realize my last post may have been misleading on this point.  I agree that server script doesn't change the reasons to avoid this.  When I said "better way" I just meant if it had to be done then it was better for the server to do it.  Of course depending on what you are testing for doing it with Javascript may be best and a very good thing to do (i.e. object detection in your script to use the object).

bol
 
03.16.2008 at 05:23PM PDT, ID: 21139160
I got my code to work with exception firefox..I am trying to pick something out of the string that is distinctive to fireforx...but failing with solutions i have found.
 
03.17.2008 at 09:12AM PDT, ID: 21143548

Rank: Genius

What is the code trying to use this info for?  The idea is you don't just get the browser type but you use that type of script to work with how browsers handle something differently (or don't support it).  What are you trying to do unique for Firefox?

bol
 
03.17.2008 at 10:59AM PDT, ID: 21144525
for a redirect to a page that is specifically built for firefox...since firefox is not used by the public like ie is ...ie has a bigger market share..i built a page that will direct viewers of my page to firefox if they are using firefox...another words they view my page from firefox...then script say hey this guy has firefox i will load firefox page so the guy can see a page that displays better in firefox...that is what i am doing.
 
03.17.2008 at 01:06PM PDT, ID: 21145621

Rank: Guru

Are you not aware that there are techniques for making one page that looks the same (within reason) in most browsers, including IE, Firefox, and Safari?

Doing that happens to be one of my specialties. (If that sentence is considered advertising or solicitation please remove it without removing the question.)
 
03.17.2008 at 02:14PM PDT, ID: 21146224
My solution for loading specific pages (like css for firefox and html tables for opera) could be avoided by swapping content on the same page as oppossed to my antiquated solution of swapping complete pages or configuring  redirects for each browser.   So all of the web page content is on one page and by "detecting" which browser is viewing (is this stil the same problem?) The browser would simply parse
frendly content?
 
03.17.2008 at 02:22PM PDT, ID: 21146293

Rank: Genius

What is that code or what specifically are you trying to get to work or avoid in Firefox?  Firefox is the second most popular browser so it is good that you are concerned about compatible code.  Knowing what you are trying to do will hopefully help us find some way to do that in script.  The change you are making is good ("parsing friendly content") but that is usually what is used to distinguish the browsers.

If for some reason you can't provide details then let us know.

bol
 
03.17.2008 at 03:58PM PDT, ID: 21147107

Rank: Guru

@greta13

Not quite. The code would be rewritten to be cross-browser compatible and CSS filters would be used where needed to deal with IE issues. For the most part Firefox, Safari, and Opera will display things the same. (Any JavaScript used might need to be modified as well. Obviously I can't tell without looking at it.)

@b0lsc0tt

  I think greta13's last comment is in reply to my last comment.
 
03.17.2008 at 04:29PM PDT, ID: 21147326
At this point i haven't determine the hangs across browser but I am trying to weight the issue...and give it due diligence..browser sniffing was an important excercise because I am learning what javascript can do and it limitations..I was surprise to run into the firefox string = netscape string problem and I was also given some good links from which to investigate the plus and minus of my approach to picking off browsers.  For right now I want to be able to write code that will properly id firefox and respond accordingly..thats next until done
thanks for your help
 
03.17.2008 at 04:37PM PDT, ID: 21147369

Rank: Guru

navigator.userAgent can be used. (I should mention that many browsers allow you to change the values of the properties of the navigator object, so it's not completely reliable.)
1:
if(navigator.userAgent.indexOf('Firefox')!=-1)
Open in New Window
Assisted Solution
 
05.17.2008 at 01:03AM PDT, ID: 21588354

Rank: Genius

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   Split: b0lsc0tt {http:#21131366} & Kravimir {http:#21147369}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

b0lsc0tt
EE Cleanup Volunteer
 
05.24.2008 at 06:23AM PDT, ID: 21639111
Forced accept.

Computer101
EE Admin
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628