[英]Redirect IE8 users to another page
I am implementing a website with Wordpress, but my website is not supported in Internet Explorer 8. 我正在使用Wordpress实现一个网站,但我的网站在Internet Explorer 8中不受支持。
Is there any code I can use so that any IE8 users will be redirected to another page? 有没有我可以使用的代码,以便任何IE8用户将被重定向到另一个页面?
I know you specified PHP, but here's a HTML/JS solution: 我知道你指定了PHP,但这是一个HTML / JS解决方案:
<!--[if IE]>
<script type="text/javascript">
window.location = "http://www.google.com/";
</script>
<![endif]-->
Taken from this answer . 取自这个答案 。
If you specifically only want to redirect IE 8 users, change <!--[if IE]>
to <!--[if IE 8]>
. 如果您特别只想重定向IE 8用户,
<!--[if IE]>
更改为<!--[if IE 8]>
。
Yes, in PHP you can use $_SERVER['HTTP_USER_AGENT']
to detect the browser and redirect accordingly. 是的,在PHP中,您可以使用
$_SERVER['HTTP_USER_AGENT']
来检测浏览器并相应地重定向。 In javascript you can you navigator.userAgent
to apply the same thing. 在javascript中你可以使用
navigator.userAgent
来应用同样的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.