最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net - my javascript works locally but not on the server why? - Stack Overflow

programmeradmin2浏览0评论

I know it is a silly question but my javascript works on very good locally, but on a some hosting server it doesn't work at all. Can any one please help me to figure it out my mistake?

Here is my javascript links:

<script type="text/javascript" language="javascript" src="../../Library/Client/Js/Utility.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/js/TlBarAction.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/Js/ControlsFunc.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/Js/Menu.js"></script>

Thanks

I know it is a silly question but my javascript works on very good locally, but on a some. hosting server it doesn't work at all. Can any one please help me to figure it out my mistake?

Here is my javascript links:

<script type="text/javascript" language="javascript" src="../../Library/Client/Js/Utility.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/js/TlBarAction.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/Js/ControlsFunc.js"></script>
<script type="text/javascript" language="javascript" src="../../Library/Client/Js/Menu.js"></script>

Thanks

Share Improve this question edited Jan 2, 2013 at 12:42 Anders R. Bystrup 16.1k11 gold badges64 silver badges58 bronze badges asked Jan 2, 2013 at 12:17 Ahmed KamalAhmed Kamal 891 gold badge3 silver badges10 bronze badges 8
  • you sure your all script files has been located well on your file server ? – hsuk Commented Jan 2, 2013 at 12:20
  • It's highly likely that its a server problem – turnt Commented Jan 2, 2013 at 12:23
  • 3 Please define "doesn't work" – Alex Commented Jan 2, 2013 at 12:23
  • 1 make sure you have uploaded all the files on server and folder hierarchy is same as of local. – rahul.deshmukh Commented Jan 2, 2013 at 12:27
  • Use the browser tools to double check why your files are not loaded. – Aristos Commented Jan 2, 2013 at 12:29
 |  Show 3 more ments

3 Answers 3

Reset to default 2

Assuming your paths are correct, is your server case-sensitive? Your code has three "JS" (capital "J") and one "js" (lowercase "j") references.

This will work fine, as is on a non-case-sensitive OS like Windows but may NOT work on a case-sensitive OS.

If your Folder inside your project configuration path then no need to give like this ../../

If your Folder inside your project just use like this src="~/Library/Client/Js/Utility.js"

If your Folder Outside of folder your project src="../Library/Client/Js/Utility.js" (one Folder)

as per the folder count you have to add ../

Check Your Some.Com IIS Configuration whether the js path correctly configured or not.

Hope this may helpful.,

If you are running in the root folder of your site then using ../ on a shared hosting server is not allowed as it breaks you out of your container. You need to make sure that you have your scripts within your root and then use ~/ or just the folder name accordingly. If you are not in your root folder then you can use ~/ but only if your website is being hosted as its own application and not just a subdirectory.

I would suggest trying Library/Client/Js/Utility.js first, then /Library/Client/Js/Utility.js and then ~/Library/Client/Js/Utility.js to see which works.

发布评论

评论列表(0)

  1. 暂无评论