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

菜鸟请教一个简单的问题

WBOY
WBOYOriginal
2016-06-06 20:34:101457browse

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

回复内容:

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

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

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

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

Statement:
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
Previous article:关于业务分层Next article:网站周期性出现500错误