Home > Backend Development > PHP Tutorial > 菜鸟请教一个简单的问题

菜鸟请教一个简单的问题

WBOY
Release: 2016-06-06 20:34:10
Original
1494 people have browsed it

<code><meta name="mobile-agent" content="format=html5;url=http://m.xxx.com/abc/">
<meta name="mobile-agent" content="format=xhtml;url=http://m.xxx.com/abc/">
<script type="text/javascript" src="http://siteapp.baidu.com/static/webappservice/uaredirect.js"></script>
<script type="text/javascript">uaredirect("http://m.xxx.com/abc/");</script>

</code>
Copy after login
Copy after login
<code>电脑版的链接是http://www.xxx.com/abc/,查看电脑页面的源码,发现含有上述的代码用来判断手机端做跳转的,想问下,那个手机链接是怎么匹配调用的,谢谢!
</code>
Copy after login
Copy after login

回复内容:

<code><meta name="mobile-agent" content="format=html5;url=http://m.xxx.com/abc/">
<meta name="mobile-agent" content="format=xhtml;url=http://m.xxx.com/abc/">
<script type="text/javascript" src="http://siteapp.baidu.com/static/webappservice/uaredirect.js"></script>
<script type="text/javascript">uaredirect("http://m.xxx.com/abc/");</script>

</code>
Copy after login
Copy after login
<code>电脑版的链接是http://www.xxx.com/abc/,查看电脑页面的源码,发现含有上述的代码用来判断手机端做跳转的,想问下,那个手机链接是怎么匹配调用的,谢谢!
</code>
Copy after login
Copy after login

一般都是先匹配手机的ua信息,如果符合就重定向。

还有判断手机分辨率的(但是不多)

看一下这个文件就都明白了嘛,: http://siteapp.baidu.com/static/webappservice/uaredirect.js , 其中应该有个 function uaredirect

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template