Absolute file path for java script

前端 未结 2 1030
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 16:26

I have a small javascript library written by myself. I want to reference it in my web application, but it doesn\'t work



        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 16:44

    Though I'm a Mac guy, my (limited) understanding of Windows security is that it has restrictions around running Javascript files "locally." Your best bet would be to copy the file to your web application's directory structure and reference it through a relative path.

    Not only will this provide greater reliability, but it's also one less thing to remember to include when deploying to a web server or somesuch. If the JS file is outside your app's folder structure, when deploying to a remote server you'll have to include it anyways.

提交回复
热议问题