2016-02-19 76 views
0

重定向Chrome用戶我有tried this但它不是我想要的東西.... 也是這個代碼不工作在新窗口

<%= Html.ActionLink("Paypal", "HowItWorksRedirect", null, new { @class = "Paypal" })%> 

public ActionResult HowItWorksRedirect() 
{ 
    return Redirect("https://www.paypal-deutschland.de/sicherheit/schutzprogramme.html"); 
} 

我想重定向所有Chrome用戶在新窗口 我想保持在我的網站上的用戶,但也將其重定向到新窗口...(600x800或類似的東西)

我該怎麼做?

+0

我想在重定向代碼

回答

0

打開一個新窗口(或標籤,取決於瀏覽器設置)很簡單: 的鏈接,你可以使用

<a href="#" target="_blank">LINK</a> 

或者你可以use JS

window.open('http://google.com', 'Google', 'width=800, height=600'); 


隨着在navigator.userAgent的幫助下,您可以獲得用戶代理並使用正則表達式來確定用戶是否正在使用Chrome

if(/Chrome/.test(navigator.userAgent)) { /* CHROME USER */ } 
+0

謝謝我知道,但我想在301重定向代碼中的新選項卡

+0

Ahm,好吧,那麼我不明白你的問題。 –

0
<script> 



//specify page to pop-under 
var popunder="http://wow.ge/" 

//specify popunder window features 
//set 1 to enable a particular feature, 0 to disable 
var winfeatures="width=800,height=510,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0" 

//Pop-under only once per browser session? (0=no, 1=yes) 
//Specifying 0 will cause popunder to load every time page is loaded 
var once_per_session=0 

///No editing beyond here required///// 

function get_cookie(Name) { 
    var search = Name + "=" 
    var returnvalue = ""; 
    if (document.cookie.length > 0) { 
    offset = document.cookie.indexOf(search) 
    if (offset != -1) { // if cookie exists 
     offset += search.length 
     // set index of beginning of value 
     end = document.cookie.indexOf(";", offset); 
     // set index of end of cookie value 
     if (end == -1) 
     end = document.cookie.length; 
     returnvalue=unescape(document.cookie.substring(offset, end)) 
     } 
    } 
    return returnvalue; 
} 

function loadornot(){ 
if (get_cookie('popunder')==''){ 
loadpopunder() 
document.cookie="popunder=yes" 
} 
} 

function loadpopunder(){ 
win2=window.open(popunder,"",winfeatures) 
win2.blur() 
window.focus() 
} 

if (once_per_session==0) 
loadpopunder() 
else 
loadornot() 

</script> 

但瀏覽器阻止!