我正在尝试仅重定向桌面上的Safari浏览器。我有一个在标题的背景颜色匹配标题背景的视频。问题是OS上的Safari以不同的方式显示颜色。在iPad和iPhone的Safari上,颜色是正确的,与Chrome,即火狐浏览器相匹配。所以我做了一个不同的颜色背景来匹配Safari桌面上的视频,但是当我为Safari重定向浏览器时,它也会重定向iPad和iPhone,然后就会显示一个颜色问题。
var uagent = navigator.userAgent.toLowerCase();
if(/safari/.test(uagent) && !/chrome/.test(uagent))
{
window.location.href = "index_safari.html"
}
任何建议只针对桌面上的Safari,并允许在ios上的Safari浏览器停留在该页面将非常感谢。
http://webedelic.com/webedelic/index.html
发布于 2017-10-10 13:56:30
您可以使用navigator.userAgent
来确定操作系统和浏览器的详细信息。
使用基于该值的类。
发布于 2017-10-18 04:13:12
我似乎不能让它在一个脚本中做到这一点,我很想这样做。
第一个重定向
var uagent = navigator.userAgent.toLowerCase();
if(/safari/.test(uagent) && !/chrome/.test(uagent))
{
window.location.href = "index_safari.html"
}
然后复制索引的页面,如果是ipad
if ( (navigator.userAgent.indexOf('iPad') != -1)) {document.location = "index_ipad.html";}
有没有人可以告诉我如何在一台电脑上做这件事?
https://stackoverflow.com/questions/46659417
复制相似问题