javascript - Call Window.Close() event for chrome and Opera from Code Behind -


as know close current browser tab chrome can use following code

    var win= window.open("","_parent",'');     win.close(); 

i have tried code in way

    function closeme() {        var win = window.open("", "_parent", '');        win.close();     } 

and invoke this:

    <asp:button id="btn" runat="server" text="close window" onclientclick="closeme()" /> 

works charm both chrome , opera.

however trying code call codebehind c#, in way:

   page.clientscript.registerstartupscript(this.gettype(), "keyname", "var win = window.open('', '_parent', '');win.close();", true); 

but unfortunately not firing up.. doubles quotes missing or javascript has not been invoked properly? synatx alright? can 1 me please.?

by security reasons chrome not allowed this.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -