html - Javascript window.close() for all browsers? -
i've been searching around problem, couldn't find that'll solve this. found lot of questions, none me.
basically, problem has no difference questions asked, tried every answers. no luck.
i want close tab of browser, when user clicks button. tried the stuff below:
1. <p class="submit"><input type="button" onclick="window.open(window.location, '_self');window.close(); return false;" value="{% trans 'close' %}"/></p> 2. <p class="submit"><input type="button" onclick="window.open('','_parent',''); window.close(); return false;" value="{% trans 'close' %}"/></p> 3. <p class="submit"><input type="button" onclick="var win = window.open('', '_self');win.close();return false; " value="{% trans 'close' %}"/></p> 4. <p class="submit"><input type="button" onclick="window.open('', '_self', ''); window.close(); return false;" value="{% trans 'close' %}"/></p>
none of above works both in firefox , chrome. if 1 works in chrome, doesn't in firefox. solution this?
better write code inside function , call function in each button
try pass true window.open('','_parent','', true);
each creating window
Comments
Post a Comment