在新窗口中重定向chrome用户

时间:2016-02-19 12:58:04

标签: asp.net google-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或类似的东西)

我该怎么做?

2 个答案:

答案 0 :(得分:0)

打开新窗口(或选项卡,具体取决于浏览器设置)很简单: 使用链接,您可以使用

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

或者你可以use JS

navigator.userAgent


if(/Chrome/.test(navigator.userAgent)) { /* CHROME USER */ } 的帮助下,您可以获取用户代理并使用正则表达式来确定用户是否使用Chrome

{{1}}

答案 1 :(得分: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>

但浏览器阻止了这一点!

相关问题