window.open()应该在同一个选项卡中打开链接 [英] window.open() should open the link in same tab
本文介绍了window.open()应该在同一个选项卡中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对JavaScript非常陌生,并且编写了一个将查询字符串作为链接的程序。
我使用了window.open(),但链接在新选项卡中打开,
我想在同一个标签中打开此链接。
代码如下。
I am very new to javascript, and written a program that will open a querystring as link.
I used window.open() , but the link is opening in new tab,
I want to open this link in the same tab.
The code is below.
var strquerystring;
if(fromvalue==""||tovalue==""){
alert('kindly fill all the details');
}else{
window.open(strquerystring);
}
推荐答案
使用
location.href = strquerystring;
而不是window.open。
然后它将更改当前的URL。
Instead of window.open. It will then change the current URL.
这篇关于window.open()应该在同一个选项卡中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文