Thursday, February 26, 2009

Object Expected error in IE for external Javascript file

Recently ran into one of those silly IE issues that can drive you nuts. I kept getting a JScript runtime error "Object expected" when I tried to call a recently added function in an external file. Funny, function works fine when in the main page. Other functions in the file worked fine. Lots of Google hits but they were all about streaming order.

The answer is that IE has cached your js file and is not reading the current version. The easiest way to correct the issue is to press Ctrl-F5 on the page in IE. This causes IE to completely reload the page.

BTW, this is during development in Visual Studio using the development server. I have a feeling that somehow IE is not seeing that the js file has changed. It may be that the dev server is not changing the date.

2 comments:

Anonymous said...

you saved my lifeee!!! had the same problem, i was going nutssss!!

Anonymous said...

you saved my life, i was going nuts!