因此,在我的MVC网站上,我需要在新选项卡中打开动态生成的URL。到目前为止我得到的代码如下:在新选项卡中打开动态生成的链接
<a class='noline' onclick="location.href='<%:@Url.Action("GeneratePaymentUrl", "Home", new {target="_blank"})%>'"> Pay Invoices</a>
public ActionResult GeneratePaymentUrl()
{
try
{
string returl = GetPaymentUrl();
if (returl.ToLower().StartsWith("http"))
{
//Response.Redirect(returl);
return new RedirectResult(returl, false);
}
else
{
return new RedirectResult("/");
}
}
catch (Exception Ex)
{
}
return new RedirectResult("/");
}
现在,必须在点击链接时生成URL;因为它会转到外部支付网关,授权时间极短。现在代码有效;它将在哪里打开正确的页面,但不是在新标签中。如果我尝试将target="blank" href="/"
添加到锚标记中;我最终在新窗口中获取了登录页面,并在原始页面中显示了付款网关。
我如何得到这个在新窗口弹出?
没错;而已。使用指定的_blank打开window.open。早晨在咖啡前张贴我的作品。谢谢! –
不用担心吉姆! –