javascript - Self exit button -



javascript - Self exit button -

i got page open js,

<a href="javascript:opennewwindow();">

now, webpage open in _self. need find way link, close window. doesnt work:

<a href="javascript:window.close();">

now do? knows improve way close self window? sec script has in opened page.

this correction of previous answer:

newwindow=window.open(); newdocument=newwindow.document; newdocument.write("hello world.<input type='button' value='close' onclick='window.close()' />"); newdocument.close();

as can see, window.close() works ok.

for specific example, can utilize -> create 2 files: 1. windowopener.html

<html> <body> <input type="button" value="open" onclick="window.open('newwindow.html')" /> </body> </html>

2. newwindow.html

<html> <body> <input type="button" value="close" onclick="window.close()" /> </body> </html>

if you'll run windowopener.html , click 'open' open 'newwindow.html'. clicking 'close' in new opened window, close it. voila.

javascript exit

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -