Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Difference between window.open("link") and window.open("link", "_blank")

I read that _blank is the default value of the name parameter on w3schools. So I was wondering if there is any benefit to adding this parameter or is it just a waste of time?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

It makes no difference to what happens. The window specification defines the target parameter as being a string with a default value of "_blank":

WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");
getter object (DOMString name);

(My emphasis.)

So not providing it at all or providing "_blank" does the same thing. It’s up to you whether including it is in some way clearer (or alternatively, unnecessary clutter).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading