Hi,
I have an ASP.NET application that will not close a Browser using the Javascript Window.Close() command.

I am opening a Browser on top of the current Browser to display and collect additional information. In the Click event of the command button on the pop-up Browser, I execute some VB.NET code prior to calling the javascript Window.Close() command. This works fine for three workstations in the office, but two workstations will execute the VB.NET code, but will not close the Browser, even clicking the X in the browser window will not close the pop-up Browser on these two workstations. They just hang. The Internet Options appear to be identical on all the workstations in the office. All the workstations are using Internet Explorer 6.0. Does anyone have any ideas as to why the pop-up Browser will not close on these two workstations?

Thanks,
Mike

Hi man i will post this to help you in the situation

Here's the code for the parent page:

public class Default : Page
    {
        protected TextBox txtFirstName;
        protected TextBox txtLastName;
        protected Label Label1;
        protected Label Label2;
        protected HyperLink HyperLink1;
 
        private void Page_Load(object sender, EventArgs e)
        {
            //create our update function
            string scr = @"<script>
                    function update(elemValue)
                  {
                    document.getElementById('txtFirstName').innerText=elemValue[0];
                    document.getElementById('txtLastName').innerText=elemValue[1];
                  }
                  </script>";
            // register the javascript into the Page
            Page.RegisterClientScriptBlock("update", scr);
            //add our popup onclick attribute to the desired element on the page (Here, Hyperlink1)
            HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'left=400, top=100, height=250, width= 250, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');");
 
 
        }

And, here's the code for the child "Popup" page:

public class popup : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.TextBox TextBox1;
        protected System.Web.UI.WebControls.Label Label2;
        protected System.Web.UI.WebControls.TextBox txtLastName;
        protected System.Web.UI.WebControls.TextBox txtFirstName;
        protected System.Web.UI.WebControls.Label Label1;
 
        private void Page_Load(object sender, System.EventArgs e)
        {  
            string scr= @"<script>
        function Done()
            {                                                                                
            var fName=document.getElementById('txtFirstName').value;      
var lName=document.getElementById('txtLastName').value;    
var ret= new Array(fName,lName);
window.opener.update(ret);        
            window.close();  
            }  
           </script>;";
            Page.RegisterClientScriptBlock("done", scr);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.