JavaScript 中的 URI 只插入到与该文档关联的对象中,因此是相对于文档 URI 而不是 JS src URI。
一个。前者
B.是的
C.我强烈建议您在所有环境中保持与根的任何路径的距离相同。要么在本地设置虚拟名称托管,要么使用 Charles Proxy 之类的东西在本地测试环境上重写您的域名。
URIs in JavaScript are only ever inserted into objects associated with that document, so are relative to the document URI and not the JS src URI.
a. The former
b. Yes
c. I'd very strongly suggest that you keep the distance of any path from the root the same across all your environments. Either set up virtual name hosting locally, or use something like Charles Proxy to rewrite your domain name over your local testing environment.
On our company's dev server we had a similar problem. We solved it by using subdomains rather then folders. So it's projectname.localhost/some/action/id/.
发布评论
评论(2)
JavaScript 中的 URI 只插入到与该文档关联的对象中,因此是相对于文档 URI 而不是 JS src URI。
一个。前者
B.是的
C.我强烈建议您在所有环境中保持与根的任何路径的距离相同。要么在本地设置虚拟名称托管,要么使用 Charles Proxy 之类的东西在本地测试环境上重写您的域名。
URIs in JavaScript are only ever inserted into objects associated with that document, so are relative to the document URI and not the JS src URI.
a. The former
b. Yes
c. I'd very strongly suggest that you keep the distance of any path from the root the same across all your environments. Either set up virtual name hosting locally, or use something like Charles Proxy to rewrite your domain name over your local testing environment.
在我们公司的开发服务器上我们也遇到了类似的问题。我们通过使用子域而不是文件夹来解决这个问题。所以它是
projectname.localhost/some/action/id/
。On our company's dev server we had a similar problem. We solved it by using subdomains rather then folders. So it's
projectname.localhost/some/action/id/
.