• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

Javascript onclick open in new tab

ONCLICK="window.location.href='http://www.google.com'"

How can I change that to open in a new tab.
0
rivkamak
Asked:
rivkamak
3 Solutions
 
leakim971PluritechnicianCommented:
0
 
Paul JacksonCommented:
Use
ONCLICK=window.open("www.google.com","_blank","")

whether this opens in a new tab or window is dependent on the user's browser preferences
0
 
rivkamakAuthor Commented:
If I use a regular a link. Can I specify a new tab versus new window?
0
 
BadotzCommented:
Nope - that is up to the browser.
0
 
BadotzCommented:
No worries - glad to help.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now