window.open 目标为“_blank"在 Chrome 中 [英] window.open with target "_blank" in Chrome

查看:62
本文介绍了window.open 目标为“_blank"在 Chrome 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的 javascript 函数,它可以在新标签页中打开一个 url:

I have a small javascript function which opens an url in a new tab:

function RedirectToPage(status) {
   var url = 'ObjectEditor.aspx?Status=' + status;
   window.open(url , '_blank');
}

这在通过单击按钮调用客户端时始终有效,即使在 chrome 中也是如此.但是在 Chrome 中,当它使用

This always works when called client-side by clicking a button, even in chrome. But in Chrome it won't work when it's called from server-side(!) by using

ScriptManager.RegisterClientScriptBlock()

在 Firefox 和 IE 中,它会在新选项卡中打开 url,但 chrome 在新窗口中打开 url.强制 Chrome 在新标签页中打开它的解决方法是什么?

In Firefox and IE it opens the url in a new tab, but chrome opens the url in a new window. What could be a workaround to force Chrome to open it in a new tab?

推荐答案

这是 chrome 中的一个设置.您无法控制浏览器如何解释目标 _blank.

It's a setting in chrome. You can't control how the browser interprets the target _blank.

这篇关于window.open 目标为“_blank"在 Chrome 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆