locked
IE9 - ajax and document.location RRS feed

  • Question

  • Hi,

     I encountered in some problem: I have login page. All commubication with server wasexecuted by using webersive.htc behavior. It worked in IE7,8. In IE9 webersive.htc is not working.

    I decided to replace the webersive.htc  with ajax(call for some webservice by ajax). It worked. But now I encouneted in another problem which I dont now how to solve.

    The problem is:

    when I validate the login name and password I allow user to navigate to the main page by changing the document. location value. It worked with previous versions, but does not work with IE9.

    I search for some solution and found that some other developers complaint about the same problem: in IE9 when there is post to server by ajax, document. location does not load a page.

    below there is a prototype for login funciton

    function Login()

    {

           1. send login details to server using ajax to validate login details

           2. if login details was ok

                2.1  document.location = "maint_page.asp"  -- this line does not load maint_page.asp page

    }

     

    Waiting for responce.

    Regards,

    Polina

     

     

     


    • Edited by polinalt Sunday, October 9, 2011 9:44 AM
    Sunday, October 9, 2011 9:43 AM

Answers

  •  The usual way is to set

      window.location.href = 'maint_page.asp';

    Try whether that works better than your attempt to set document.location.

    If not then try whether doing

      window.setTimeout(function() { window.location.href = 'maint_page.asp'; }, 0);

    allows you to get the browser to load the new document maint_page.asp.


    MVP Data Platform Development My blog
    • Marked as answer by Yanping Wang Friday, October 14, 2011 6:56 AM
    Sunday, October 9, 2011 10:55 AM