firefox does not close window

Last Reply on Jun 11, 2012 10:55 PM By Amit

Posted on Jun 08, 2012 07:49 AM

I use javascript on my vb page,it is working fine in IE and chrome but not in firefox ........

 Page.ClientScript.RegisterStartupScript(Me.GetType(), "asr4", "var win=window.open('','_self');win.close();", True)

I also use

 

function winClose()
{
window.top.opener=null;
window.close();
}

or

function closeWindow()
{
window.open('','_parent',''); 
window.close();
}
But non of these is working in firefox..............
You are viewing reply posted by: Amit on Jun 11, 2012 10:55 PM.
Posted on Jun 11, 2012 10:55 PM Modified on on Jun 11, 2012 11:04 PM

It works in IE but not in firefox and chrome..........check my code below :

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        

        Dim host As System.Net.IPHostEntry

        host = System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST"))

 

        strHostName = host.HostName.ToLower()

        strHostIP = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()

 

        If Not (strHostName = "ved1" Or strHostName = "amit" Or strHostName = "deepak" Or strHostName = "santos" Or strHostName = "shafeeq1") Then

            'Page.ClientScript.RegisterStartupScript(Me.[GetType](), "asr4", "alert('Dear " + strHostName.ToUpper() + " you dont have permission to access this page');var win=window.open('','_self');win.close();", True)

            Page.ClientScript.RegisterStartupScript(Me.[GetType](), "asr4", "window.close();", True)

            txtedit.Visible = False

            Exit Sub

        End If

 

First dark/highlighted portion works in Chrome and IE and second one work's only in IE

 

        user.Text = "Welcome " + strHostName

        user.Visible = True

 

        If Not IsPostBack Then

            bindgrid()

        End If

 

    End Sub