I have a page app/views/shared/_tcpsocket.html.erb
and am trying to include the following two javscripts:
<script src = 'http://localhost:8000/static/Orbited.js' content-type='application/x-javascript'></script>
and
<script src = 'http://localhost:8000/static/protocols/xmpp/xmpp.js' content-type='application/x-javascript'></script>
But neither of them are recognised. I have checked and the addresses are valid. How do I link to these files? Do I need a javascript_include_tag
? I always seem to struggle linking to external .js files.
Thanks.
Why are you putting spaces between the src
, =
and value for this attribute? Try not putting these spaces there and see what results. I believe that HTML is parsing each space-separated value as its own attribute.
尝试把它放在头上。
<%= javascript_include_tag 'static/Orbited.js','static/protocols/xmpp/xmpp.js' %>
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.