Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  23] [ 2]  / answers: 1 / hits: 17146  / 14 Years ago, mon, april 12, 2010, 12:00:00

I'm writing some Javascript code and I'm trying to change the current page as the result of the user clicking a button. I'm using this snippet of code:



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



containing the relative URL within my site that I want to navigate to. When this code runs (looking at it in Firebug), the url string looks correct, but the page just does a refresh to what it's currently on. Looking at the headers with HttpFox the first thing I see is a result of (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 anyone help me determine what's going wrong here?



Thanks in advance!
Doug


More From » url

 Answers
3

You may get NS_BINDING_ABORTED when a load is interrupted by something else, typically a page navigation.



How are you calling this method? If it's in response to a click on a link or button, you may be forgetting to return false to cancel the default action. In which case first your script would start to navigate to /customer/order/12, then the link or form would be followed, causing a navigation that cancels your script's one.


[#97093] Friday, April 9, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
benitoh

Total Points: 150
Total Questions: 113
Total Answers: 104

Location: India
Member since Wed, Aug 26, 2020
4 Years ago
benitoh questions
Sun, Mar 21, 21, 00:00, 3 Years ago
Mon, May 13, 19, 00:00, 5 Years ago
;