javascript - How I will close the current tab -
how close current tab in asp.net? works in ie not in firefox or chrome.
i publish code , run cannot run.
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script language="javascript" type ="text/javascript" > function closeme() { // alert('1') // setinterval( closeme1() , 5000); var win = window.open("", "_self"); win.close(); } function closeme1() { alert('2') var win = window.open("", "_self"); win.close(); } function closemefire() { alert('f') var browser = navigator.appname; alert(browser) var indexb = browser.indexof('explorer'); alert(indexb) if (indexb > 0) { var indexv = navigator.useragent.indexof('msie') + 5; var version = navigator.useragent.substring(indexv, indexv + 1); if (version >= 7) { alert('sdf') window.open('', '_self', ''); window.close(); } else if (version == 6) { alert('dhgf') window.opener = null; window.close(); } else { alert('dhgf1') window.opener = ''; window.close(); } } else { alert('dhgf2') window.close(); } } function closewindow() { // window.open('', '_parent', ''); window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:button runat="server" text="close me" onclientclick ="closeme()" id="closeme" /> <asp:button runat="server" text ="fire closeme" onclientclick ="closemefire()" id="button1" /> <asp:button runat="server" text ="fire1 closeme" onclientclick ="closewindow()" id="button2" /> </div> </form> </body> </html>
Comments
Post a Comment