简体   繁体   中英

my javascript works locally but not on the server why?

I know it is a silly question but my javascript works on very good locally, but on a some.com 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM