Javascript-How to implement target=_blank in a simple link

JoeJoe2416

So, this is my code:

function link1() { window.location.href="Example"; }

How do i achieve the _blank function in JS?

Cheers

(Note: I am not using a library, nor am i intending to atm)

Mark

window.open will do the trick.

function link1()
{ 
   window.open("http://www.example.com");
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Target _blank in all Link

From Dev

How to make php-textile Open Link in a _blank target

From Dev

How to open a link with target from JavaScript

From Java

How to add target="_blank" to JavaScript window.location?

From Dev

Changing a target link with javascript

From Dev

Open a WKWebview target="_blank" link in Safari

From Dev

Onclick to show content and target="_blank" another link

From Dev

open link with target="_blank" can´t fix it

From Dev

Add target blank to link if is .pdf - jQuery

From Dev

simple_format is stripping out target _blank

From Dev

How do you delay an click event on a link (with a _blank target) and still have the new tab open?

From Dev

How do you delay an click event on a link (with a _blank target) and still have the new tab open?

From Dev

How to add target="_blank" into this code

From Dev

How to style target="_blank" anchors?

From Dev

Confused by how to write OO Javascript to implement simple class pattern

From Dev

Confused by how to write OO Javascript to implement simple class pattern

From Dev

How to implement a simple < operator

From Java

Link with target="_blank" and rel="noopener noreferrer" still vulnerable?

From Dev

"Open link in new tab" in browser vs. "target=_blank" in HTML

From Dev

Rails link_to and onClick with target=_blank does not work together

From Java

open link in new tab with github markdown using target="_blank"

From Dev

target=_blank doesn't work with GA outbound link tracking

From Dev

Add target=_blank to one link in JS file for wordpress theme

From Dev

WordPress opens link in same window despite target="_blank"

From Dev

Add target blank on base64 link encoded

From Dev

Dynamically change _target="blank" to _target="self" using JavaScript

From Dev

How to click on a simple link?

From Dev

How to copy directory symbolic link as a link to the target?

From Dev

How to use both onclick and target="_blank"

Related Related

  1. 1

    Target _blank in all Link

  2. 2

    How to make php-textile Open Link in a _blank target

  3. 3

    How to open a link with target from JavaScript

  4. 4

    How to add target="_blank" to JavaScript window.location?

  5. 5

    Changing a target link with javascript

  6. 6

    Open a WKWebview target="_blank" link in Safari

  7. 7

    Onclick to show content and target="_blank" another link

  8. 8

    open link with target="_blank" can´t fix it

  9. 9

    Add target blank to link if is .pdf - jQuery

  10. 10

    simple_format is stripping out target _blank

  11. 11

    How do you delay an click event on a link (with a _blank target) and still have the new tab open?

  12. 12

    How do you delay an click event on a link (with a _blank target) and still have the new tab open?

  13. 13

    How to add target="_blank" into this code

  14. 14

    How to style target="_blank" anchors?

  15. 15

    Confused by how to write OO Javascript to implement simple class pattern

  16. 16

    Confused by how to write OO Javascript to implement simple class pattern

  17. 17

    How to implement a simple < operator

  18. 18

    Link with target="_blank" and rel="noopener noreferrer" still vulnerable?

  19. 19

    "Open link in new tab" in browser vs. "target=_blank" in HTML

  20. 20

    Rails link_to and onClick with target=_blank does not work together

  21. 21

    open link in new tab with github markdown using target="_blank"

  22. 22

    target=_blank doesn't work with GA outbound link tracking

  23. 23

    Add target=_blank to one link in JS file for wordpress theme

  24. 24

    WordPress opens link in same window despite target="_blank"

  25. 25

    Add target blank on base64 link encoded

  26. 26

    Dynamically change _target="blank" to _target="self" using JavaScript

  27. 27

    How to click on a simple link?

  28. 28

    How to copy directory symbolic link as a link to the target?

  29. 29

    How to use both onclick and target="_blank"

HotTag

Archive