简体   繁体   中英

HTML cannot load css and js file in iOS/OSX project

it work perfect when the css and javascript write in the HTML file, but it is not working after extracting the javascript code to a separate file. have some way to fix it? Thanks in advance!

Get it, We do not need to add the detail path to load the js/css file. No matter which folder u put your css/js file, just do like this:

<link rel="stylesheet" type="text/css" href="your.css">
<script src="your.js"></script>

don't do this:

<link rel="stylesheet" type="text/css" href="css/your.css">
<script src="js/your.js"></script>

If www has sub-folders, when drag it into Xcode, make sure select Create folder references for any added folders . This option will keep www structure. js/css files will loaded successfully.

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