阅读:1466回复:0
Some Php Http_user_agent Header Redirect, Firefox-only.(zz)
Cool:
<?php //Firefox-only redirect. $from = getenv("HTTP_USER_AGENT"); if (strpos($from,'Firefox') != true ) { //If it's not Firefox, redirect: Header ("Location: http://nostromo.no.funpic.org/"); exit; } //Else if Firefox, then run the rest of the page :) echo('HTTP_USER_AGENT contained Firefox'); ?> phpBB: <div class="copyright"> <a href="http://www.spreadfirefox.com/?q=affiliates&id=66183&t=86" target="top" class="copyright" style="text-decoration: none;" > <script type="text/javascript"> <!-- useragent=navigator.userAgent.toUpperCase(); pos=useragent.indexOf("FIREFOX"); if(pos>=0) {document.write("You're currently using Mozilla Firefox!");} if(pos<0) {document.write("Tried using Firefox? rediscover the web!");} //--> </script> </a> </div> Website <a href="http://www.spreadfirefox.com/?q=affiliates&id=66183&t=86" target="top" class="copyright" style="text-decoration: none;" > <script type="text/javascript"> <!-- useragent=navigator.userAgent.toUpperCase(); pos=useragent.indexOf("FIREFOX"); if(pos>=0) {document.write("You're currently using Mozilla Firefox!");} if(pos<0) {document.write("Tried using Firefox? rediscover the web!");} //--> </script> </a> In javascript you can use the navigator.appName feature to get the actual name of the browser As in: <script language="javascript"> document.write("You are using "+navigator.appName+"."); </script> or <script language="javascript"> var browser=navigator.appName; if(browser=="Firefox") window.location.href = "firefoxpage.html"; </script> Browser detection should be done with JavaScript, because some browser can and do send an invalid or false identifier. |
|
|