HTML 脚本元素 localhost uri

发布于 2024-08-21 11:12:16 字数 277 浏览 2 评论 0原文

这似乎是一个愚蠢的问题,但请考虑以下使用 'script' 元素导入外部 javascript 文件的情况:

<script src="http://localhost:8085/myscript.js" type="text/javascript" >

鉴于这是一个 url 而不是文件路径,这将在服务器端还是客户端进行评估?

如果在客户端进行评估,那么它会失败,因为脚本驻留在服务器上,而不是客户端的“本地主机”上?

谢谢。

This may seem like a silly question, but consider the following use of the 'script' element to import an external javascript file:

<script src="http://localhost:8085/myscript.js" type="text/javascript" >

Given that this is a url and not a file path, would this be evaluated server side or client side?

If evaluated client side, then it would fail as the script resides on the server, not the 'localhost' of the client?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玻璃人 2024-08-28 11:12:16

客户端,是的 - 分别。

Client side, and yes - respectively.

梦里梦着梦中梦 2024-08-28 11:12:16

myscript.js 文件从服务器 (localhost:8085) 下载,然后由客户端的浏览器执行。

Javascript 始终在客户端执行。

The myscript.js file is downloaded from the server (localhost:8085) then executed by the browser on the client-side.

Javascript is always executed on the client-side.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文