简体   繁体   中英

Trouble linking css and js files in html head

I have been studying Web Development for the past couple months and have consistently had trouble with linking to both local and global files in html. I'm wondering if there is something I'm missing, usually when I'm experimenting with bootstrap for example I will simply go on bootstraps site and copy the links from their getting started page. For whatever reason the css will link fine but the js file will not. To test the functionality I just copy some of their code examples and paste them and the styling works fine but the js functionally doesn't. That's just one example of something I have been dealing with since I started Web Development. It's very discouraging to literally copy and paste links like that and have it not work. I feel like I could be making some simple mistake but I'm just not sure. I'm always careful to include the files in the order that they need to be compiled (external js files that I use before my own files, etc.) And I also always test to see if I'm using the wrong '/' and I still can't consistently get external links to function properly. Is there something I'm missing?

This most likely has to do with the Same-Origin Policy

The easiest alternative here would be to use something like JSFiddle or simply download the js files. If you want a truly interactive web development workflow, use Google Chrome's development tools with workspaces .

It'll allow you to live edit js/css files on the fly and see the changes as you make them. This is really good for someone still trying to learn the ropes as it'll give you constant feedback.

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.

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