开发者

Javascripts that detects mobile browser (and redirect) inside of SharePoint

开发者 https://www.devze.com 2023-01-24 09:54 出处:网络
Can anybody tell me the javascript that detects if the web browser is mobile and redirect to diffent page (if it is mobile browser) inside of SharePoint (Content Editor Web part)?

Can anybody tell me the javascript that detects if the web browser is mobile and redirect to diffent page (if it is mobile browser) inside of SharePoint (Content Editor Web part)?

I think I need a 开发者_JAVA百科javascript for that where I can put it in the source editor.


In javascript you can always ask for the navigator and check diferent properties like navigator.userAgent that will give you something like this

User-agent header: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7

That string you can search deviceIphone, deviceIpod for mac devices and so on for the different browsers. 

You can use something like this http://detectmobilebrowser.com/ to avoid checking manualy each diferent movile provider, but sometimes is good to make especific pages for some devices.

You can also check diferent browsers serverside and make a redirect before.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号