简体   繁体   English

将js文件链接到hbs文件

[英]Linking js file to hbs file

I'm having great difficulty trying to link my js file to one of my hbs files. 我很难将js文件链接到我的hbs文件之一。 For some context, within my hbs file I have: 在某些情况下,在我的hbs文件中,我有:

<script src="../homepage.js" type="text/javascript"></script>

Now, the homepage.js file is found one folder above where the hbs file is located, so thats why I'm using ../ in th src. 现在,在hbs文件所在的位置上方的一个文件夹中找到homepage.js文件,这就是为什么我在src中使用../的原因。 When I try to run my app, however, I am met with "homepage.js 404 error" in the browser console. 但是,当我尝试运行我的应用程序时,在浏览器控制台中遇到“ homepage.js 404错误”。

If anyone knows what could be going wrong, it would be greatly appreciated. 如果有人知道出了什么问题,将不胜感激。

Thanks! 谢谢!

homepage.js may not be in your webroot. homepage.js可能不在您的webroot中。 If this code is in a page in your root directory, then your are asking the browser to retrieve something that you have not made publicly available. 如果此代码位于根目录下的页面中,则您正在要求浏览器检索尚未公开发布的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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