Jump to content

Browser


driz
 Share

Recommended Posts

Hello,I need to make some code that when the user uses Internet Explorer they are directed to a page like /browser_not_supported/this redirect should be instant and you should NOT see any part of the website beforehand.On this NEW page, I need to be able to STILL go to the website even so they are using IE, so like I can warn them, but they CAN still visit the page if they really insist on using IE. I take it this would be done using cookies?Thanks. xnote: this is how I intend the page to work like: 2658069261_c2df9e32c2.jpg

Link to comment
Share on other sites

found this script for general browser detection... but I dont have access to a php server or even IE7 to test at the moment. Perhaps if you change the IF where the output is, and have an ELSE setup otherwise.ie: just direct to the continue page in the IF of an IE7, and the else would be to just continue on.

<?phpecho ( browser_detection( 'number' ) .'<br>'. browser_detection( 'browser' ) .'<br>'.  browser_detection( 'os' ) .'<br>'.  browser_detection( 'os_number' ) ); ?>

Outputs (browser version, browser, os, os number): 1.5moznt5.1

<?phpif ( ( browser_detection( 'browser' ) == 'ie' ) && ( browser_detection( 'number' ) >= 5 ) ){echo 'it is Internet Explorer ' . browser_detection( 'number' );// or anything else you want to happen of course}?>

Link to comment
Share on other sites

Yes, cookies would probably be the best way to keep track of the IE users. See http://www.quirksmode.org/js/detect.html (EDIT: Oops, wrong language...) for the actual detection and http://www.w3schools.com/PHP/php_cookies.asp for the cookies.Where did you find that PHP browser_detection function? I only know about http://www.php.net/manual/en/function.get-browser.php, but that requires browscap.ini.

Link to comment
Share on other sites

You have both just confused me!basically domain.com needs to KNOW if your using IE, and then direct to domain.com/browser/ if you are using IE, if not it should just load the site like normal. The browser page should have a continue button that will all access to the site EVEN SO your using IE, so this decision must be stored using a cookie. Thanks. x

Link to comment
Share on other sites

meh im so so lost :Scan someone show the code that needs adding to the page that checks, eg. the main site!and then the code for the page that has the continue button that will be ALLOWING access to the site even so your using the IE browser. x

Link to comment
Share on other sites

Can we try to work through your confusion? Throw us some questions and let us teach you... A page built to a customer's order is what I would expect from someone who gets paid, but that's irresponsible in our case. We're doing this on our free time and building your knowledge is more important than building your page.

Link to comment
Share on other sites

Well I learn from things like this! I'm very good at xhtml/css but would never have learned from a book or stuff like that, I learned by ripping sites tweaking that until eventually I had enough knowledge I could do it myself. The same with PHP I prefer working with working stuff and learning how its working etc, rather than reading all the functions and trying to figure out what goes where.So basically I was looking for the code, I dont want you to build the page im gonna do that, I just need to php code (which i will probably modify anyways). xTHANK YOU FOR HELPING!

Link to comment
Share on other sites

So getting questions answered isn't an effective way for you to learn? You're making me curious... (how ironic, lol)You want to warn all versions of IE, right? Not just the latest few?So far as I can tell (from running a makeshift IE on Linux), this works:

<?php$warned = isset($_COOKIE['warned']) ? $_COOKIE['warned'] : $_GET['warned'];if(strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") && $warned != 'true'){	?><html>	<head>		<title></title>	</head>	<body>		This site is not fully compatible with Internet Explorer!  But, if you want to <a href="<?php echo $_SERVER['PHP_SELF']; ?>?warned=true">go in anyway</a>, be our guest.	</body></html>	<?php}else{	if(!isset($_COOKIE['warned'])){		setcookie('warned', 'true');	}	?><html>	<head>		<title></title>	</head>	<body>		Here's our regular content...	</body></html>	<?php}?>

My only gripe with this is that Lobo spoofs itself as IE (with the "MSIE" string) so IE-only sites will let it in.On a side note, I wasn't intending to give myself kudos in my last post (or maybe my subconscious actually was); I'm trying to correct errors I've made in the past where I operated like a vending machine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...