Tragically, you can’t at present do that – – however you can draw near. You can open another window, and in case you do that without indicating any window aspects or window highlights, most present day programs will open another tab all things considered (contingent upon the client’s inclinations, however at that point, you need to do what the client favors at any rate, right?). So window.open(url) or window.open(url, name) in case you will utilize the name for something. Make certain to do this in direct reaction to a client started occasion, if not the program’s spring up blocker will probably…block the spring up. :- )
Concerning center around your window…good karma with that. You can call window.focus() after window.open(…), however I would say it doesn’t generally work.
Tossing it out there: If you make what the client interfaces with a certified connection with a URL, the client can choose whether to open it in another tab, another window, whatever and regardless of whether to give it center (in case they’re adequately refined to know Shift+Click and Ctrl+Shift+Click, or the right-click menu).
- To open another tab, we need to utilize _blank in second boundary of window.open().
- The return worth of window.open() is a reference to the recently made window or tab or invalid assuming that it fizzled.
- Try not to add a third boundary to it as it will bring about the kickoff of another window rather than a tab
HTML <a> target attribute provides an easy and simple way to open the linked URL in the new browser window or tab. You need to use the _blank value in the target attribute to open the linked URL in a new tab or window.
<a href="https://www.codexworld.com" target="_blank">Visit CodexWorld</a>
_blank in the second parameter of
https://www.codexworld.com in a new browser tab or window.
Also Read: How to get file extension in Python?