简体   繁体   English

在新标签页中打开新链接

[英]Opening new link in new tab

Hi I am working on j2ee web application. 嗨,我正在开发j2ee Web应用程序。 But I am facing one problem when I am trying to open clicked new link in new tab. 但是,当我尝试在新标签中打开点击的新链接时,我遇到了一个问题。 As if it is opening new tab but it is appending url link over my web application root context path. 好像它正在打开新选项卡,但是它将URL链接附加到我的Web应用程序根上下文路径上。

My web page where I am clicking. 我要单击的网页。

在此处输入图片说明

And the error page shown below, 而错误页面如下所示,

在此处输入图片说明

As you can see I am able to open new tab but problem is it link is appended with root path shown by yellow color. 如您所见,我能够打开新选项卡,但问题是它的链接附加了以黄色显示的根路径。

I tried this by this code, 我通过这段代码尝试过

window.open("www.yahoo.com", "_blank");

also tried using, 也尝试使用

<a href="www.yahoo.com" target="_blank">Click Me</a>

if you don't specify http:// the standard is to take the path of your site in this case localhost:8080 .. 如果您未指定http://则标准为采用本站点的路径,在本例中为localhost:8080 ..
try this: 尝试这个:

<a href="http://www.yahoo.com" target="_blank">Click Me</a>

or this: 或这个:

window.open("http://www.yahoo.com", "_blank");

if you do not specify a protocol then it is assumed to be a local address ( local to your website ) 如果您未指定协议,则假定该协议是本地地址( 您网站的本地地址)

So use http:// at the start.. 因此,一开始使用http://

target="_blank"

这是说链接应该在空白页中打开的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM