0

The question says it all. I tried this code, but what happens is it closes the newly opened window instead of closing the current window where this code is being placed in.

<a href="javascript:void(0);" onClick="window.close;window.open('http://somesite.com', 'SomeWebsite', 'width=800,height=700,menubar=no,status=no');">
try me :D
</a>

I want to close the window where this code was in. and open the new window with the said parameters. thanks a lot in advance

CudoX
  • 985
  • 2
  • 19
  • 31
  • 1
    Could be wrong, but I'm pretty sure your code will just close the window. Once the window closes, no future code is going to execute. – War10ck May 19 '14 at 20:01
  • it didn't even closed the current window where this code was in – CudoX May 19 '14 at 20:02
  • Have you see this post? Timeout might help you: http://stackoverflow.com/questions/3681178/html-javascript-to-open-new-window-and-close-current-window – Micor May 19 '14 at 20:02
  • Do you close the door before you walk through it? That is basically what you are trying to do there. Closing should be the last action. Plus in most modern day browsers, if you did not open the window, you can not close it. – epascarello May 19 '14 at 20:03
  • the question might be not clear. but obviously i intend it to be opening the new link then close the window. – CudoX May 19 '14 at 20:04

0 Answers0