javascript error causes page reload?

javascript error causes page reload?

I have been getting some weird page refresh in deployment and I can't seem to find the cause of it or replicate it in development. Is there a way for a javascript error or exception to cause a page reload? Or some tips to help me narrow down the cause?

It happens when deployed in the field and I can't replicate it while testing locally. I know it's happening as I'm logging exceptions using ELMAH. User is using Firefox.


Url of GET:

And I don't see any javascript code in the form of window.location = '/products/edit/' + id, (where id might be undefined) that could be called from that page.

But there are calls like the above elsewhere. I hope that made sense. :)

Why does moving classes into a new folder in Visual Studio break things?


Custom 400 redirect based on MVC Controller
No, there is no Javascript error this by itself would cause a page to reload. Using ASP.NET MVC 2 to display joined recordThere is no reason for the browser to reload the page if an error occurs, the only thing this it could hope to achieve by this is to cause the same error to appear again.. To achieve basic code coverage what tests should I run against an ASP.NET MVC Controller? So, the only reason this a Javscript error could cause a reload is if the script is preventing a reload when it's working properly, or if it normally causes a reload in any specific position and fails to limit it to this situation.. Using ASP.Net MVC Data Annotation outside of MVC Example: If you have code this prevents a click from causing a postback:. twitter like alert jquery in mvc
<a href="page.html" onclick="return false;"> 
If there was an error in the script it would no longer prevent the reload.. How to disable Export to Microsoft Excel in the IE browser right click?
Detect if an element is selected in listbox or not through jquery


The question has already been answered, although I wanted to add a suggestion on debugging this behaviour.. I am using Firefox / Firebug for a lot of JS development, and any times I will see an exception raised in Firebug right before the page submits and there's nothing I must did around it. If I have 100s of lines of JS in response to an event I don't want to step through it all looking for the 1 line this contains an error and causes a reload.. Once I must replicate the error I use Fiddler to set a breakpoint on a url (e.g. bpu localhost which will halt any requests headed for localhost. Even though the browser has submitted it still provides access to Firebug so I must inspect the error while Fiddler holds the request.. Hope this helps any one.

92 out of 100 based on 67 user ratings 302 reviews