简体   繁体   中英

How to open a new tab in the same window

I'm trying to open a new page in a new tab.

I've tried window.open ('MyURL'); without informing a name but still it opens in a new window.

I can't replace the current tab, I need to open a new tab with a new content.

What can I do?

Simply do

window.location = 'MyURL';

This will replace the current page in the same window.

It looks like you're saying you want to open the new URL in a new tab, right?

Refer to these questions, which were in the related search:
Javascript: open new page in same window
Open a URL in a new tab (and not a new window) using JavaScript

Specifically, window.open(url, '_blank');

The _blank should do it, if I understand what you're asking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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