簡體   English   中英

僅在桌面上重定向Safari瀏覽器

[英]Redirect Safari Browser on a Desktop only

我試圖僅在桌面上重定向Safari瀏覽器。 標題中有一個視頻,其中背景顏色與標題背景匹配。 問題是OS X上的Safari顯示顏色不同。 在iPad和iPhone的Safari上,顏色正確,與Chrome,IE和Firefox匹配。 因此,我設置了不同的顏色背景來僅與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

您可以使用navigator.userAgent確定操作系統以及瀏覽器詳細信息。

根據此值使用類。

我似乎無法在一個腳本中做到這一點,我很想這樣做。

第一次重定向

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";}

有人可以讓我知道如何做到這一點嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM