NS_BINDING_ABORTED Javascript window.location.replace ()

I am writing Javascript code and I am trying to change the current page as a result of a user clicking a button. I use this piece of code:

window.location.replace ("/ customer / order / 12");

containing the relative URL of my site I want to go to. When this code works (looking at it in Firebug), the url line looks right, but what is currently included on the page is just updating. Looking at the headers with HttpFox, the first thing I see is the result (Aborted), Type: NS_BINDING_ABORTED. However, if I issue this command:

window.location.replace ("/ customer / order / 12");

from Firebug, the browser goes to the correct URL that I specified ("/ customer / order / 12").

Can someone help me determine what is going wrong here?

Thanks in advance! Doug

+4
source share
1 answer

You can get NS_BINDING_ABORTED when the load is interrupted by something else, usually page navigation.

What do you call this method? If, in response to a click on a link or button, you can forget return false , to undo the default action. In this case, first your script will start moving around /customer/order/12 , after which a link or form will follow, as a result of which your script will be canceled.

+12
source

Source: https://habr.com/ru/post/1306735/


All Articles