CrazyRob
Sep 22 2006, 03:33 PM
| | Hi everyone,
oik so there is this design im doing for a new site and the problem is that the site does not display properly in Internet Explorer but it does in firefox. How do i get the site to redirect you to a page that says somthing like "you need to have firefox instalkled to view this page" if you are not running firefox? |
Reply
AeonLan
Sep 22 2006, 04:54 PM
I thought you might want to look into this. I got this code snippet a long time ago. ^_~ CODE <?php
function browser_detection( $which_test ) {
// initialize the variables $browser = ''; $dom_browser = '';
// set to lower case to avoid errors, check to see if http_user_agent is set $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
elseif (stristr($navigator_user_agent, "msie 4")) { $browser = 'msie4'; $dom_browser = false; }
elseif (stristr($navigator_user_agent, "msie")) { $browser = 'msie'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "mozilla/4")) { $browser = 'ns4'; $dom_browser = false; } else { $dom_browser = false; $browser = false; }
// return the test result you want if ( $which_test == 'browser' ) { return $browser; } elseif ( $which_test == 'dom' ) { return $dom_browser; // note: $dom_browser is a boolean value, true/false, so you can just test if // it's true or not. } }
?>
The above function can be called by: CODE $user_browser = browser_detection('browser');
if ( $user_browser == 'opera' ) { do something; } or you may want: CODE if ( browser_detection('dom') ) { execute the code for dom browsers } else { execute the code for non DOM browsers } and so on.......
Reply
CrazyRob
Sep 22 2006, 05:09 PM
ok so how would i put that into my page? would i add it to the top or bottom or in the middle of the page code?
Reply
AeonLan
Sep 22 2006, 05:18 PM
Declare the function definition inlined with other function definitions of your php page or just simply put it on the top. As for the usage, you can place the if(...) statement where you would like the script to be executed, like: CODE /* Log in and verification or something you want to be executed first */ /* Continue */ /* Then if you want to detect browser now use the browser detection */ /* Sample */ $this_browser = browser_detection('browser');
if($this_browser == 'msie' || $this_browser == 'msie4'){ // Redirect user } else { // continue loading page }
Reply
CrazyRob
Sep 22 2006, 05:28 PM
ok im still confused so here is the code CODE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" />
<meta name="description" content="Lorem Ipsum" /> <meta name="keywords" content="Lorem Ipsum" />
<meta name="robots" content="index,follow" />
<title>Mx Scripting</title>
<link href="template02.css" rel="stylesheet" type="text/css" media="all" /> <style type="text/css"> <!-- .style2 { color: #1c6ea8; font-size: 22px; } --> </style> </head>
<body> <div id="container"> <div id="header"> <h1> </h1> </div> <div id="mainnav"> <ul> <li><a href="#"> Contact us </a></li> <li><a href="#">clients</a></li> <li><a href="#">services</a></li> <li><a href="#">Partners</a></li> <li><a href="#">FOrums</a></li> <li><a href="#">Home</a></li> </ul> </div>
<div id="mainnavsub"> <ul><li><a href="#"></a></li> <li><a href="#">latest News </a></li> <li><a href="#">RSS Feeds </a></li> <li><a href="#">Advertise</a></li> <li><a href="#">About US </a></li> </ul> </div>
<div id="sidebar"> <h3>Menu</h3> <div id="nav-right"> <ul> <li><a href="http://www.mxscripting.net/html/">HTML Scripts </a></li> <li><a href="http://www.mxscripting.net/php/">PHP Scripts </a></li> <li><a href="http://www.mxscripting.net/asp/">ASP Scripts </a></li> <li><a href=""></a></li> <li><a href="http://www.mxscripting.net/templates//">Premium Templates </a></li> <li><a href="http://www.mxscripting.net/freetemp/">Free Templates </a></li> <li><a href="http://www.mxscripting.net/graphics/">Graphics </a></li> <li><a href="http://www.mxscripting.net/css/">CSS Style Sheets </a></li> <li><a href=""></a></li> <li><a href="http://www.mxscripting.net/wtools/>Webmaster tools </a></li> <li><a href="http://www.mxscripting.net/validators/">HTML Validators </a></li> <li><a href="http://www.mxscripting.net/cssvalid/">CSS Validators </a></li> </ul> </div> <h3> </h3> <h3>Advertisment</h3> <p class="thumbs"> <a href="index.html"></a><script type="text/javascript"><!-- google_ad_client = "pub-6827643994408753"; google_ad_width = 200; google_ad_height = 200; google_ad_format = "200x200_as"; google_ad_type = "image"; google_ad_channel =""; google_color_border = "282828"; google_color_bg = "282828"; google_color_link = "282828"; google_color_text = "000000"; google_color_url = "1C6EA8"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></p> <h3> Forum Installed </h3> <p>We have now succesfully re-installed the forum and a new skin is being devloped which should properly blend into the site. </p> </div> <div id="content"> <h1>Welcome to Mx Scripting </h1> <p>Welcome to Mx Scripting, as you may notice we are currently updating our site so you may notice some major changes. We hope to build a huge and active community like we once had. Untill the main bit of our site is finished why not register on the forums and meet other members of the Mx community. </p> <h2>Send us your scripts</h2> <p>If you have a script or a link that you think may fit into one of the catogories why not send them to us via the Contact Form we will then reveiw it and who knows your script may show up on this very site. </p> <p> </p> <p class="style2">Advertise on this site</p> <p>If you would like to advertise on this site, please Fill out the Advertise Form which can also be found in the Contact Us area of the site. We opperate our advertising system in cost per impression which when tested was found the be the cheapest option. </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <p>
<!-- End Side bar and thumbs -->
<!-- Start of footer data --></p>
<div id="footer-contents"> <p id="footer-links"><a href="http://validator.w3.org/check/referer">[XHTML 1.0]</a> <a href="http://jigsaw.w3.org/css-validator/">[CSS]</a></p> </div>
<!-- End of footer data -->
</div> </body> </html>
can you tell me where i can put the code in?
Reply
AeonLan
Sep 22 2006, 05:45 PM
Oh I see.... What you posted is an HTML file. You need to have a PHP file to run this codes. Does your host support PHP? If yes, make an index.php and put this.. inside CODE <?php
global $this_browser;
function browser_detection( $which_test ) {
// initialize the variables global $browser = ''; global $dom_browser = '';
// set to lower case to avoid errors, check to see if http_user_agent is set $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
elseif (stristr($navigator_user_agent, "msie 4")) { $browser = 'msie4'; $dom_browser = false; }
elseif (stristr($navigator_user_agent, "msie")) { $browser = 'msie'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "mozilla/4")) { $browser = 'ns4'; $dom_browser = false; } else { $dom_browser = false; $browser = false; }
// return the test result you want if ( $which_test == 'browser' ) { return $browser; } elseif ( $which_test == 'dom' ) { return $dom_browser; // note: $dom_browser is a boolean value, true/false, so you can just test if // it's true or not. } }
//Redirection $this_browser = browser_detection('browser');
if($this_browser = 'ns4'){ header("Location: forum/index.php"); exit(); } else { echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> </head> <body> <center> <h1>Your browser does not support this site</h1> </center> </body> </html>';
?>
Reply
Saint_Michael
Sep 22 2006, 05:59 PM
Although from the conversation I am having with mxweb off the site, his concer is more css related then actualy browser support, in which he would have to create another set of css that goes with the browser that a person is using. So you need to include in the php css link as well as the browser type, what I suggest is go to pixel2life.com and then search redirect in php and they have some scripts that do what your asking in your post.
Reply
AeonLan
Sep 22 2006, 06:01 PM
I see. Third-party scripts are more preferred as they have been tested many times and continuous maybe available.  Well ~Happy Coding.
Reply
CrazyRob
Sep 22 2006, 06:21 PM
Ok yes its fixed now thanks just had to clarify a few things with mike as i wanted a second opinion.
Reply
AeonLan
Sep 22 2006, 06:27 PM
Nicely done. Good job. ^_~ Remember, even if you have solved the problem, try to think of better solutions to that problem. Until Satisfaction is met.
Reply
Latest Entries
CrazyRob
Sep 23 2006, 05:46 PM
Well everyone makes mistakes somtimes lol anaway ts all fixed now and things are starting to go online.
Reply
jlhaslip
Sep 22 2006, 08:23 PM
MXweb (and Others, too), One way to handle the IE css problems is to create a second css file and use this sample of HTML to direct the user's Browser to implement the second CSS file if they are in fact using IE. I find it simpler to do this than to have a whole whack of hacks for the different IE (and other) Browsers. HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html lang="en"> <head> <title>Purcell Crossing Consultants Group : Page: </title> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" > <meta name="expires" content="0" > <meta name="description" content=" A description of the pccg site needs to be included here." > <style type="text/css" media="screen"> @import "./fixed4all.css"; </style> <!--[if IE]> <link href="./fixed4ie.css" rel="stylesheet" type="text/css" media="screen"> <script type="text/javascript">onload = function() { content.focus() }</script><![endif]-->
</head>
Reply
AeonLan
Sep 22 2006, 06:42 PM
LMAO!!!! ~ Don't click the show/hide mxweb... XXD Lesson to be learned: Analyze codes line by line before asking for help .
Reply
Similar Topics
Keywords : redirect script depending users browser- Directory Script
- (1)
- Meebo Browser-based Multi-messenger.
- (1)
meebo meebo is a really nice site, it's an browser-based messenger where you can log-in
into Yahoo!, MSN, GTalk, AIM, ICQ, Jabber all at once and you don't need to download any
client or any software. I know this site has been introduced to Trap17 members but that was way back
when this site wasn't so popular and everyone was like, "Urgh, I don't think it is safe to
go there." but now I say, as it is I've been using it for over a month now that it is completely
safe to use meebo. You can do various things after your register yourself there :...
What Is The Best Browser Software?
- IE - FireFox - Opera... (2)
I can see that in last tear a lot of people changed browser. So the question is natural. Why? And
why that one, and not an other one?
In order
to better understand the question, I asked:
...
Redirec Script
- (7)
I need a scrip that redirects to my forum to index_cm.php, i cant change the name of that file...
Best Internet Browser
- What is the ..... (3)
What is the Best Internet Browser i really like Firefox because of its multitabbing and other things
you can do with it and i like Opera cuz of its nice interface so whats your favorite /happy.gif"
style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />...
Forum Script Error
- (3)
hey, im getting this error when im trying to view a message on my forum, QUOTE Parse error:
syntax error, unexpected T_VARIABLE in /home/luki/public_html/forum/viewtopic.php on line 26 and
this is what is on line 26 in that file.. i don't know waht's wrong with it. QUOTE
LIMIT$start, ".$board_config ; and this is what it loks like all together... QUOTE
define('IN_PHPBB', true); define('IN_CASHMOD', true); define('CM_VIEWTOPIC',
true); LIMIT$start, ".$board_config ; $cm_viewtopic->generate_column...
Website Designing And Browser Compatibility
- making a website looked the same for all (2)
I've been making websites for years but i'm very out of practise and looking to have another
go and have a few questions. 1. How should i go about making a website that looks the same (or
nearly the same) in all browsers/all resolutions? Should i be using percentages instead of pixel
amounts, should i not be using HTML at all? In the past it's not something that's bothered
me too much but i know that there are so many browsers and screen resolutions that it's
something i should pay attention to now. 2. When it comes to making a website that correspo...
I Am Looking For Free Domains
- not a redirect but something good (2)
Well, is it possible to get a free domain that you can use with Trap17.com ? because the only ones I
have came across you cannot use, eg. .co.nr domains, .cjb.net etc. and I was wondering, if you could
get a free domain. .be used to have free domains before christmas, but they cost now ;( so does
anyone have any links to free domains you can use with Trap17.com, if so, could you please tell me
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Thanks if you do
/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue...
Hmm Better Site Than Trap17? (for Phpnuke Users)
- uh oh i think i found a better site lol check it out urself (6)
freephpnuke.org hmm i wus just looking for some phpnuke shoutboxes and i found this site that
allows you to make a free account with phpnuke....and it even came with the shoutbox ive been
wanting...and you dont have to do nething to try to keep your server up unlike trap17 =P...well for
you phpnuke users i think this site is for you.. i find it to be really kool to be able to just have
a free nuke site just lke that....and plus you dont have to set it up....they set it up for you
isntantly...peace pls try this site out n tell me what you think p.s. even thou i found t...
Referral Script
- (2)
Hey everyone, I need 2 Different kind of refferal system scripts. One is a non registering one and
the other one is a registering one. Okay well ill explain what i need for each script. For the non
registering one i need: It to log what SITES sent users to my site. It also needs to automaticly
list the sites that have sent a curtain number of people to the site, and the number of people needs
to be custamizable by eather a control panel or a scipt option. And for the registering one i need
the script to automaticly provide my users with a Referral URL. It also need...
Good Billing Script
- (0)
does anybody here know of any good billing script like merchant bil;l that are free or very cheap...
Heads Up For Java, Activex And Flash Users
- Big changes required (4)
http://www.sitening.com/blog/2006/03/30/th...nd-on-april-11/ ...
Web Hosting Script
- (5)
Hey everyone, Im wondering if any of you know of a Web Hosting Script. The primary use of this
script will be to give the users of my site we space. I already have my server set up. My server
currently uses a 100 GB space system With apatche running on the servering computer and it is all on
High Speed DSL. If you could, link the script from where it came from. And Also please make sure
it is an ACTUAL Web hosting script not just a register script. thanks...
What Is Your Favorite Web Browser?
- (3)
Please say, what is your favourite web browser and why?!...
Mp3 Player For A Webpage
- script? (8)
anyone know where you can get a mp3 player to put on the site? where you can upload your own music
and choose a song to play it? it can be any language, so if you know any, giev me the link. Made
topic descriptive. ...
Firefox Browser Extensions
- Make Mozilla FireFox as YOU like it (7)
Here is a tutorial to make Mozilla FireFox as YOU like it. In this topic, I will post some Mozilla
FireFox ,with some notes on every link. Enjoy! /biggrin.gif' border='0'
style='vertical-align:middle' alt='biggrin.gif' /> Abdlock Instead of trying to block
advertisments with unrealiable firewalls and anti-spywares, you can use Adblock in oder to block the
advertisements you choose. After the installation of the extention, blocking an advertisement is as
simple, as right-clicking it, and Selecting Adblock. Then, you can just block the selected ad, or
block th...
Login Script Problem
- (0)
i have created a login script that enables my costomours to login into there cPanel,web mail and if
there a reseller WHM. But when i test the script on the webserver its dosnt work on some pages, on
the pages that dont work i get this error message QUOTE Method Not Allowed The requested method
POST is not allowed for the URL /index.htm. Apache/1.3.34 Server at www.mxweb.co.uk Port 80 and
i know its nothing to do with the frontpage server extentions, and what gets me is that it works on
some pages but not others. Ive tried everything in my knowlage to get it worki...
No Right Click - Javascript
- No Right Clicking Script (6)
I made this script for disabling the right-click option. It works with all major web browsers (IE,
Mozilla, Firefox, Netscape...). Just put it into the head section of your document. QUOTE
<script language="JavaScript"> var message="Sorry, no right clicking!"; isIE=document.all;
isNN=!document.all&&document.getElementById; isN4=document.layers; if (isIE||isNN) {
document.oncontextmenu=block; }else{ document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
document.onmousedown=block; } function block(e) { if (isN4) { if (e.which==2||e.which==3) { aler...
Need Some Help With A Little Php Script...
- Thanks (7)
I have found on the net a free script with, what I think is, a small bug! Since I don't know
anything about php (i'm programming in delphi) i'm looking for someone who is familiar with
this php and it is wants to help me. If so please PM for me to give the details.... Thanx a lot,...
Php Include Script
- How to add into a table (6)
You can see at cerb.trap17.com how I have my menus set up. For each of the 3 side menus, I would
like to use a PHP include script, rather than iFrames. This is the code I've been playing around
with: CODE <?php include('myframe.htm'); ?> With myframe.htm
being the page I want to include in that cell. For some reason it will not include the page. Is that
the correct code for doing such a thing? Am I doing something wrong; leaving something out. maybe?
Thanks....
How To Make Website Users Flee In Horror
- so you know what NOT to do ;) (1)
Make every user to your website flee in horror at a mere glance. It's so easy, anyone can do
it! 1. Be Inconsitent! It's easy for your users to get disoriented navigating the
Internet when every page within your web site looks different. Navigation and page layout should
never be consistent throughout the web site. 2. Show Off What You Just Learned! No matter how
gaudy, it's good! Show off that new animation trick, or Internet gadget because it may not
work with all browsers. With something flashy drawing the users attention away from th...
Bloging Script
- Is there any? (9)
Is there any applications like PHPNuke which is able to post blogs to your personal website?...
Site Users
- (0)
i have a few people coming to my website and they view the gallery but nothing else and nobody wants
to become a member of my site and i was wondering what i should do to get them to?...
Firefox
- What do you think about this browser? (14)
I upgraded to firefox about 2 months ago. It's way better than Explorer. I thought my internet
was slow because of my computer. Turns out, i just had a crappy browser (Explorer). If you
haven't, you should definitely make the change to firefox....
Looking for redirect, script, depending, users, browser
|
|
Searching Video's for redirect, script, depending, users, browser
|
advertisement
|
|