开发者

Dynamically referencing a javascript file

开发者 https://www.devze.com 2023-04-10 23:15 出处:网络
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.

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 ~ an开发者_如何学Cd saying runat="server" but it just gives some jquery error ("Unexpected character '\'" on Line 18 of the minified jquery) when trying to run it.


Use Page.ResovleUrl for all of your files:

<script src='<%# Page.ResolveUrl("~/Assets/jquery-1.4.2.min.js")%>' type="text/javascript"></script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号