我想将所有特定年龄的浏览器分流到他们自己的页面.这样做的最佳方法是什么?也许包含在标题中的一些JS:
<!--[if lte IE 7 ]>
<script type="text/javascript">
window.location = "/unsupported-browser/";
</script>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
以上不应该将浏览器发送到:http://example.com/unsupported-browser/我有一个基本的控制器和视图来处理它?这么简单吗?
Rob*_*lin 16
在php中执行此操作.使用user_agent类并重定向到该页面.
但更重要的是,为什么不允许IE用户访问您的网站?是由于CSS还是别的什么?
码:
$this->load->helper('url');
$this->load->library('user_agent');
if ($this->agent->browser() == 'Internet Explorer' and $this->agent->version() <= 7)
redirect('/unsupported-browser');
Run Code Online (Sandbox Code Playgroud)
编辑:
如上所述; 如果您希望在整个站点上运行此项,请在MY_Controller中运行此项,并确保添加$this->uri->segment(1) != 'unsupported-browser'为额外条件以避免重定向循环.
| 归档时间: |
|
| 查看次数: |
10587 次 |
| 最近记录: |