我想在同一窗口和同一标签页中打开包含链接的页面。
当我尝试使用window.open
打开链接时,它会在新标签页中打开,而不是在同一窗口的同一标签页中打开。
我想在同一窗口和同一标签页中打开包含链接的页面。
当我尝试使用window.open
打开链接时,它会在新标签页中打开,而不是在同一窗口的同一标签页中打开。
就像这样:window.open("www.youraddress.com","_self")
使用 HTML5,您可以使用历史记录 API。
history.pushState({
prevUrl: window.location.href
}, 'Next page', 'http://localhost/x/next_page');
history.go();
let url = history.state.prevUrl;
if (url) {
console.log('user come from: '+ url)
}
window.open(url, <tabNmae>)
。window.open("abc.com",'myTab')
对于接下来的所有 window.open,使用相同的选项卡名称代替_self
,_parent
等。你可以做
window.close();
window.open("index.html");
它在我的网站上成功运行。
Just Try in button.
<button onclick="location.reload();location.href='url_name'"
id="myButton" class="btn request-callback" >Explore More</button>
Using href
<a href="#" class="know_how" onclick="location.reload();location.href='url_name'">Know More</a>