Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-15-2007, 02:02 PM   #1
Beta Member
 
Join Date: Mar 2007
Posts: 4
Default Browser Detector HTML

Hey guys, I apologize if this subject has been covered before, I searched for it, and couldn't fine anything similar.

I have a website that I want it to only be viewed by firefox users. I want it so if you have firefox, you will be directed to the site, and if not, you will be directed to a different page. I know it's possible, because I have seen it on several websites I have entered.

Thank you in advance.

- Mayo
__________________

mayo is offline   Reply With Quote
Old 03-15-2007, 02:11 PM   #2
j03
~~~~~~~~
 
Join Date: Jan 2005
Location: Wales
Posts: 5,556
Send a message via MSN to j03
Default Re: Browser Detector HTML

Google? But Anyway:

Code:
<html>
  <script>
  if(navigator.userAgent.indexOf("Firefox") != -1)
  {
     window.location = "http://www.i-code.co.uk";
  }
  else
  {
     window.location = "http://www.mozilla.org/products/firefox/";
  }
  </script>
  </html>
__________________

j03 is offline   Reply With Quote
Old 03-15-2007, 02:21 PM   #3
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: Browser Detector HTML

May I ask why you only want Mozilla user's? Good design will support whatever the user throws at it. It would probably be better to have a code in javascript that detects the browser and renders elements on the page differently. If it's a matter of a style problem for example: Firefox does not support the double property for border, whereas IE does. Let's assume we have a div tag on the page and we want to give it a border. fix:
Code:
<head>
<script type="text/javascript">
<!-- if the browser can't read javascript we put the comments here so that the code is not rendered as text
function checkBrowser() {
if(navigator.appName("Firefox") {
document.getElemetById("mainDiv").Style.add("border-style", "solid");
}
else {
document.getElementById("mainDiv").Style.add("border-style", "double");
}
}
// stop hiding -->
</script>
</head>
<body onLoad="checkBrowser();">
<div id="mainDiv" style="border-style: solid; border-width: 1px; border-color: #000000; padding: 5px; height: 100px; width: 100px; position: absolute; top: 50px; left: 135px;">
This is a test
</div>
</body>
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 03-16-2007, 08:47 AM   #4
Beta Member
 
Join Date: Mar 2007
Posts: 4
Default Re: Browser Detector HTML

Quote:
Originally Posted by Daeva
May I ask why you only want Mozilla user's? Good design will support whatever the user throws at it. It would probably be better to have a code in javascript that detects the browser and renders elements on the page differently. If it's a matter of a style problem for example: Firefox does not support the double property for border, whereas IE does. Let's assume we have a div tag on the page and we want to give it a border. fix:
At first I wanted it to be firefox because that is the browser i was using when making the website in dreamweaver. Later on, I found out that the website is messed up when viewed from IE. So I changed it so it's compatible with IE. Now, it looks relatively ok for both browsers, a bit messed up on firefox.
I need that code anyway for another part of the site. Thank you very much, it helped a lot
mayo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 01:37 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0