1

Kinda related to my first question, my site runs fine locally but as soon as I deploy to IIS the javascript file/s are not being called properly.

In the <head> tag of my Master page:

<script src='/Assets/jquery-1.4.2.min.js' type="text/javascript"></script>
<script src='/Assets/hoverIntent.js' type="text/javascript"></script>
<script src='/Assets/superfish.js' type="text/javascript"></script>
<script src='/Assets/supersubs.js' type="text/javascript"></script>

This works on visual studio dev server but not on IIS. I tried adding ~ and saying runat="server" but it just gives some jquery error ("Unexpected character '\'" on Line 18 of the minified jquery) when trying to run it.

Community
  • 1
  • 1
notAnonymousAnymore
  • 2,637
  • 9
  • 49
  • 74
  • Is there a reason you can't just use a relative path? – glenatron Oct 06 '11 at 13:44
  • Have you tried browsing to the paths above in your browser? the / at the start means you're defining absolute paths, so check they're still valid. eg http://yourhost/Assets/hoverIntent.js – Simon Halsey Oct 06 '11 at 14:01

1 Answers1

1

Use Page.ResovleUrl for all of your files:

<script src='<%# Page.ResolveUrl("~/Assets/jquery-1.4.2.min.js")%>' type="text/javascript"></script>
rick schott
  • 21,012
  • 5
  • 52
  • 81