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
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
Recent Queries:--
redirect freephpnuke to mysite - 717.82 hr back. (1)
-
redirect depending on media - 1151.59 hr back. (1)
Similar Topics
Keywords : redirect, script, depending, users, browser
- Welcome All New Registered Users Of Trap17
Please read as soon as you join. (0)
Need Help With Javascript Drag And Drop Script
Having trouble with javascript drag and drop script. (2) hi, i have been trying to create a drag and drop menu for my new website, so that the navigation
menu can be moved around the site. This is the code i have: CODE <html> <head>
<title>Test run - Right click menu</title> <script
type="text/javascript"> function coordinates(event) { if
(event.button==2) { var x=event.x; var y=event.y; }
document.getElementById("element").style.left=x;
document.getElementById("element").style.top=y;
document.getElementById("eleme....
Google Keyboard: Computer Keyboard For Core Google Users
Share your Ideas, Opinions & Suggestions for Google Keyboard (3) Hello, As I was coming back home from work, me and a colleague were discussing about how helpful
and faster chrome is compared to firefox (Firefox still rules though /xd.gif"
style="vertical-align:middle" emoid=":XD:" border="0" alt="xd.gif" />) Well chrome got me thinking
about what if Google launched a keyboard of its own... Now it set me thinking about what goodies
I'd like in this keyboard. First of all I think it would be awesome if the keyboard could
automatically synchronize with Chrome so that speed dial or something could be possible. Now my idea
was that....
Deny Or Grant Users Access To Files Of Choice (vista)
Uses Bat Files To Deny Or Grant People Access To Files (3) Deny Or Grant Permission Requires Notepad Vista This Technique Can be Used On Earlier
Versions Of Windows But Uses Different Syntax: To Deny Access Open Notepad and Type @echo off
cls Icacls PATH OF FILE GOES HERE WITHOUT PARENTHESES /deny USERNAME OF PERSON YOU WANT TO DENY:(F)
And To Grant Is The Same Process @echo off cls Icacls PATH OF FILE GOES HERE WITHOUT
PARENTHESES /grant USERNAME OF PERSON YOU WANT TO DENY:(F) And There It Is. Simple Huh!....
Firefox Hates Moveplayer
Help me save my crashing browser. (5) I have a serious problem on my main PC. Firefox refuses to open. It goes directly to the crash
report, listing the add-ons that failed on startup. I managed to launch it from the Run window into
Safe Mode, and again it crashed immediately, but this time only listed one add-on: MovePlayer. The
uninstall instructions I found require a Firefox capable of loading. I'm running Windows XP and
have no listing for Move in my Add/Remove Programs dialog. What's my next step?....
Java Script To Hide The Url In Address Bar
Does any one know about this ? (6) Hello friends , just now i came accross a particular type of script which is capable of masking the
URL which is seen in the Address bar of the webpage , that is by implementing the particular Java
Script when the user visits a page eg. www.mysite.com , then it is possible for the admin of
www.mysite.com to mask this site and display some other website in the viewers address bar. I came
to know that such a script can be written using Java Scripts , Can any one get me the Script ??....
Google Chrome Reviews
What do u think of Google's latest freeware browser? (27) I’m not suprised by this. Chrome auto updates itself without my consent (although I did consent for
it to autoupdate in the EULA /tongue.gif" style="vertical-align:middle" emoid=":P" border="0"
alt="tongue.gif" /> ) and the installation is so force (like not being able to customize anything…).
Things like that are usually signs that the company’s attitude towards the costumer is less that
perfect. Big corporations, that’s what you get. At least it’s open source, so it’ll probably fare
well (if google doesn’t manage to tank the whole thing). It’s not like browsers that ....
Whats Your Favorite Web Browser
(15) 1. Is Opera the fastest Browser around. 2. What do you think of googles new browser Chrome, does it
beat Firefox 3? 3. Does anyone even use Internet explorer?....
[request] Avatar For Trap17 Users
Nice one... for my avatar rotator script (0) As per the description above, I would like to challenge the GFX people here on the Trap17 to design
a nice, bright, clear, professional looking 'avatar' for me and other members to use. I
plan on including it in my Rotator Script, which I think can be found in the Tutorial Section here
on the Trap17. (If not, I must write that one soon). /laugh.gif" style="vertical-align:middle"
emoid=":lol:" border="0" alt="laugh.gif" /> I'm thinking that we need to open this up as a
Competition so all Members can contribute and then the Admins can start a new section in ....
How To Open Control Panel In Just My Regular Browser
(2) I'm able to access the control panel when I use a proxy server, but proxies can't handle all
scripts and such. Why can't I access the control panel in firefox or internet explorer. Whenever
I click on the link it just times out.....
Google Chrome Installer Fails
Google web browser Chrome fails to initialize the installation process (3) Hi, I tried to install Google Chrome web browser on my Windows XP computer and faced the following
error each time: "Access to this application is restricted." Well! I do not exactly know where
this comes from but I guess that it is one of Google's racist issues. As I tried from my home
country Iran, some Google services like Google Code are not available due to bans that the company
has put on particular advanced services. Because the installer first comes from the sub-domain
code.google.com I think that the same cause also applies here. The question is if....
Google Releases Browser Aka Chrome
Beta release (47) Breaking News: Google is releasing its own custom browser called CHROME. (Beta release) See Article
at PC WORLD: Google to Release Open-Source 'Chrome' Browser Make sure to check out
the comic book that covers CHROME's feature set and how it distinguishes itself from its soon to
be rivals. Should be released in another 15 minutes EST. ....
Apple Makes Everything Safari
Pros and Cons of Safari Web Browser (0) Not quite a "safari" tool - safari comes from the Persian word "safari" means "something suitable to
use for a traveler" - with its size three times more than the last version of Mozilla FireFox, it
promises a "clean look" and also "no more concentration on the browser but on the web itself"!
The look and feel of Safari web browser is not what you expect from Apple but it has a taste of
Apple's previous hits like Quick Time with clean outlines and easy-to-use look. The progress
bar is integrated at the top with the address bar, a bit confusing and new, but sti....
Cannot Redirect Audio Output To Bluetooth Headset
Using an Ericsson HBH-60 with a Sprint PPC6700 (3) I have a problem that you people may be able to help me with. I have a Sprint PPC6700
smartphone, like the one above. I have been using it quite fine with my Ericsson HBH-60 bluetooth
headset, as pictured above. I used to use it to listen to music sometimes, and I could divert the
audio output to the headset just by pressing the activate button on the headset. This all worked
fine for some time, but now it doesn't. What changed is that I installed the ALU 2.2 update on
the cellphone, which is a ROM flash upgrade. This upgrade has been really great, and has op....
Internet Explorer - The Worst Standards Compatible Browser Ever Made
(13) I hate that peace of junk web-browser, and I don't know what THE HELL were Microsoft's
devs thinking when they made it and decided it to be bundled with the OS and not making it nearly
good enough as other variants. I can say, yes, I understand that a browser needs to be
incorporated into the OS, otherwise how could a man go and surf the web or download other browser?
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> But I can't
understand on what crack were the devs when they created IE 4 (and higher browsers, though....
Opera Mini - A Great Mobile Phone Browser
(1) Opera Mini is my favorite mobile web browser and it's in it 4.1th version. Get it here
http://www.operamini.com In this newewst version of Opera Mini, the devs from Opera Software ASA
offered us lots and lots of addons and new feaures to the bestest mobile browser in the world, like:
Find in page - find text in page, with simple pressing on # and then * on the phone's keyboard
and then entering the text you are searching for, and the app. will find the text with a speed of a
computer browser. It's really useful when you are looking (eg.) for some informat....
Japanese Browser Called Sleipnir
(4) I came across this browser by a fluke chance when I was checking out articles at PC World, and from
what I remember from the article this is a very big name browser in Japan and they wanted to expand
it to the international market. What really caught my eye is that they want to get 5% of the
international market in the browser wars in the next couple of years. To give a background story to
this browser, it was developed in 2005 in both English and Japanese and after 3 years it gain some
popularity in the international community and so now they are trying to enter thems....
Best Browser To Desighn Your Site To
not much of a question but more like a statement (28) well since i started web desighning i've always used internet explore (why?) well when i first
tried FF2, i wasn't a "web-designer" then so i didn't care much about css and htlm stuff, i
din't like it and one of the reason was beacause a couple of the sites i visited wasnt firefox
compatible. but anyways recently i was desighning a site for this community. so like two weeks ago i
downloaded FF3 for testing purposes. in IE the site looked great but what i found was that in
firefox the site was horible, as bad as they could come. so since firefox was better....
Making My Own Browser
Uhm...need a name (10) I am currently developing my own Web Browser and I need a name for it /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So if you got any good
ideas please do post them /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
alt="biggrin.gif" />....
Firefox 3 Sucks - Time For Another Browser
(69) No seriously, I've been using Firefox since 0.x releases. I loved it. Every release, despite
having no huge features, was a great update. Version 3, however, totally messes everything up. Its
default interface is ugly. And no Home button, really ??? (ps. I kno i can drag it back from the
bookmarks toolbar but still, its stupid). The address bar search thing. I liked the concept, but I
am so used to the old way, this actually distracts me, I don't want to search my history
everytime I type a new address. Plus the slide out is huge now making the whole thing feel t....
Very Simple Online Now Script
This is a very simple online now script. (4) Hi all, Its Aldo. anyways, I wont be using the method of pagination, i will just tell you how to
make a basic online now script. When someone logs in, now take into consideration that the name of
the username input is username ( First ,create a table in your database saying online now and add 2
fields to it. id and username CODE id type=integer(INT) , auto increment, length =255
and username = VARCHAR length=the limit a username should be in your site now from there we take
off : CODE <?php //logged.php //authentication script //connection scri....
Jsp Or Java Chat Script Like Mig33
(5) so most of you guys know mig33. its a wap application,probaly java.most kindly to be java. does
anyone have java knowlege or knows where i can get a chat script like mig33? i also know this server
supports jsp so im planing to use it for my application. i was hosted here last year but moved
because i found a better host. now im back just to use the jsp on this server. Im planing to run
chat applictions so if any one wants to help me in my project let me know.....
Internet Browser For Nintendo Ds
Only for DS Lite :o (41) Hey, I want to rant about something - thats why I am here. Today we went to the mall and I went
past EB Games (they sell games hence the name). I picked up their catalouge and I was looking
through it while we were walking around the mall. I saw a page on the Nintendo DS. I have a Nintendo
DS (not a DS lite) and I think it's a really good system. On this page was the DS Internet
browser, you of course need to have a Wireless Net connection or a Wi-fi USB Adapator for the DS to
beable to connect to the net. I wanted a USB Connector anyway so that was no trouble. I wa....
Trap17 Link Exchange Script Introduced
(28) Hi, We have introduced a link Exchange Script at Trap17. http://www.addlivelinks.com/ The
categories are yet to be setup. It will be done as we receive link requests. Thanks. -OpaQue....
Verifying Email Addresses
Using a simple PHP script (9) This simple script will allow you to run some basic checks to make sure that any email address
entered is actually an email address. There is no guarantee offered that this will stop every single
fake email address, but it'll provide some protection. Now, the code! First we need to get
the email address to verify. Here, I get it using POST from an HTML form. CODE <?php //Load
email address from web form $email = $_POST['email']; Now, we move on
to our first check. Does the text that has been entered look like it could b....
Guestbook (cgi-script) Problems
Do u know much bout chmod and cgi-cripts? (5) Hi! I'd like to make a guestbook with a cgi-script I found at Lissa Explains it All .
There were instruction bout how to install this gbook: click here QUOTE Active Guestbook
Unzip the file, you'll find 4 separate files: guestbook.cgi mail.gif url.gif readme.txt 1.
Open guestbook.cgi in a plain text editor like notepad. Find out your path to perl from your Web
host, and change the first line to reflect that. The default setting, #!/usr/bin/perl, usually
works for most servers. If not, you can try #!/usr/local/bin/perl. Save your changes. ....
[help] Java Script: Window.open
Works with Firefox, not IE (10) CODE <HEAD> var popUpWin=0; function popUpWindow(URLStr) {
if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); }
popUpWin = open(URLStr, 'GunBound Tactics: Screenshots',
'width=820,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=90,left=90')
;; } </HEAD> <BODY> <a
href="javascript:popUpWindow('/f11/clipped.php');"><b>Clips&
#60;/b></a> This is a script for opening a new window. It works ....
Many Php Script Sites
(16) Hi I find many sites has PHP scripts :: http://www.proxy2.de/scripts.php http://www.free-php.net
http://knubbe.t35.com/ http://www.ngcoders.com/ http://www.oxyscripts.com/
http://www.phparena.net/ http://www.1phpstreet.com/ http://px.sklar.com/
http://www.scoznet.com/ http://php.resourceindex.com/ /blink.gif' border='0'
style='vertical-align:middle' alt='blink.gif' /> ....
Php Quiz Script
Make quizzes for your site. (22) Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
doesnt do anything special but I am going to make an email mod for it so that it will email results
to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
<html> <head> <title><? echo "Gamers Pub $qid";
?></title> </head> <body> <p><h3><? echo "....
What browser do you use?
(706) I use IE 6, enhanced from Win XP SP2. I want to see what other people use for browsers, and maybe
start a discussion. This place needs more activity... /wink.gif" style="vertical-align:middle"
emoid=";)" border="0" alt="wink.gif" />....
Looking for redirect, script, depending, users, browser
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for redirect, script, depending, users, browser
*MORE FROM TRAP17.COM*
|
advertisement
|
|