Posted By

itsmeritesh on 11/18/09


Tagged

blank windowopen


Versions (?)

Function to Open URL's in a new browser window


 / Published in: JavaScript
 

Call this function with a URL and it will open it in a new browser window. Its synonymous to auto clicking a link with the target="_blank" attribute set.

  1. function myOpenWindowCode()
  2. {
  3. var oWin = window.open("http://www.google.com", '_blank');
  4. if (oWin) {
  5. if (oWin.focus) oWin.focus();
  6. return false;
  7. }
  8. oWin = null;
  9. return true;
  10. }

Report this snippet  

You need to login to post a comment.