views:

86

answers:

2

I am trying to run a simple ASP.Net Web Application/Site on Vista Box. Unable to run any JavaScript when I hit F5. However when I deploy the same to local IIS and call the application using IE8 this application works and the JavaScript executes.

Another observation, when I copy the URL (example: http://localhost%3AXXXXX/yyy/Default.aspx) to a new tab within the same instance of IE8, this same happens. JavaScript do not run.

But when I browse the same application using another instance of IE8 the application runs well, meaning JavaScript executes properly. where do I set it or override it. Please help

I am suspecting that its something to do with the Instance of VS2008 running on vista home premium, so in all the above failure cases I was running VS2008 as an Administrator.

Please help and let me know how to resolve this. Thanks in advance.

A: 

My blind guess would be that there is some problem with the path to your javascript files. If you could post the .aspx file that has the javascript that isn't running it would help a lot.

UPDATE: Thanks for the comment with the html, you should consider adding it to your question.

This problem sounds like a timing related issue to me (and your html doesn't seem to have any issues) so here is what I think will help:

1) Move the following code to the bottom of the page.

<script type="text/javascript"> 
    $(function() { 
        $("#accordion").accordion({ collapsible: true }); 
    }); 
</script>

2) Don't use relative URLs for your script/css tags. So your <script> tags should look like:

<script src="/Scripts/jQuery/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/ui/ui.core.js" type="text/javascript"></script> 
<script src="/ui/ui.accordion.js" type="text/javascript"></script>

3) consider using a minified version of Jquery and the other script files to reduce load times for them. Also, you might want to consider using a CDN hosted version of Jquery (from google, or microsoft).

If none of these suggestions work I would suggest posting the HTML for the entire page into your question.

Jared
Jared,I have included only a snippet of the page(due to size limitations) in comments.<head runat="server"> <script src="Scripts/jQuery/jquery-1.3.2.js" type="text/javascript"></script> <script src="ui/ui.core.js" type="text/javascript"></script> <script src="ui/ui.accordion.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="themes/base/ui.all.css" /> <script type="text/javascript"> $(function() { $("#accordion").accordion({ collapsible: true }); }); </script></head>
Sanjeev
A: 

Couiple thoughts

1) your instance of IE8 might have JS turned off 2) path issues (as suggested by Jared) 3) the "local path" issue; some browsers block Js that appears to be running from disk (might be a setting in your IE 8 to fix.

Paul