3

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)

sanorpetro
  • 413
  • 1
  • 4
  • 10

1 Answers1

3

window.open will do the trick.

function link1()
{ 
   window.open("http://www.example.com");
}
Mark
  • 3,224
  • 2
  • 22
  • 30
  • 2
    Indeed. Provided this is called during the processing of a user-initiated event (otherwise, the pop-up blocker will do its job). – T.J. Crowder Jan 29 '14 at 18:26