Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open in new tab after ajax response in javascript

Open in new tab after ajax response in javascript is not working,

tried with _newtab and _blank

But none of them is working,

I say,

Is there any solution to get the answer ?

like image 621
Mani M Avatar asked Dec 31 '25 00:12

Mani M


2 Answers

From JavaScript, you cannot open new tabs. You can only open new windows. It's up to the user's browser settings how it opens new windows (be it in a new tab, a new tab in the background, or a new window).

JavaScript does not and cannot even know if your browser supports tab. And it does not have access to anything on the outsides of the browser (unless there's leverage from an extension I suppose).

And as a reminder, there are browsers with no tabs, and others with no windows even. Tabs are just browser features, and never part of any language specification.

like image 179
Joseph Avatar answered Jan 01 '26 17:01

Joseph


Use this -> window.open(YourUrlInsertHere, '_blank');

like image 37
Sajith Athukorala Avatar answered Jan 01 '26 16:01

Sajith Athukorala