Advertisement
Guest User

HOW TO OPEN LINKS IN NEW TAB

a guest
Jun 25th, 2019
1,983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Step one. Find your HTML page with links on it.
  3.  
  4. Step two. Copy this code:
  5. <javascript>function boom(url) {
  6.   var win = window.open(url, '_blank');
  7.   win.focus();
  8. }
  9. </javascript>
  10. And paste it into your code near the very top, directly AFTER the <head> tag. If your code has no head tag, place one inside your <html> tag but above your <body> tag and then paste the above code there. Any questions let me know.
  11.  
  12. Step three. Find you link code, it should look something like this:
  13. <a href="myurl">my link</a>
  14.  
  15. Step four. Replace your full link code (including the <a> tag) with this code:
  16. <div onclick="boom('myurl');">my link</div>
  17.  
  18. And just like that you have reduced the workload of users by 50% at least, sometimes a lot more for mobile users.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement