0

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?

Ajoy
  • 1,838
  • 3
  • 30
  • 57
Eu Kaique
  • 13
  • 2

2 Answers2

1

Simply do

window.location = 'MyURL';

This will replace the current page in the same window.

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
0

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.

Community
  • 1
  • 1
shortstuffsushi
  • 2,271
  • 19
  • 33
  • Sorry for the incorrect title, would be best "opening a new tab in the same window" When I use the onclick event directly The browser opens a new tab But if I use window.open in a function OpenReport function () {     window.open ('DespxFat.aspx); } The browser opens a new window – Eu Kaique Aug 02 '13 at 20:24
  • So did the _blank help with that? I guess I've never see that behavior differ from place to place like that. – shortstuffsushi Aug 06 '13 at 14:45