In the integration of HTML page inside the CI frame, loading css and JS failed, get a long time to find the CI framework is the framework of the portal, all the files in the framework of the request need to go through index.php processing, when loading external CSS and JS file to use the Base_ The URL () function handles external links.
Like what:
The base_url in the Config profile is: "localhost:8080/Project name/"
accessing application/resource/aaa.js files in the controller
Relative path <script src= "Resource/aaa.js" ></script> access failed
1, directly in the SRC output
<script src= "<?php echo Base_url ();? >.resource/aaa.js "></script>
2. Use Base label
Place the output of the Base_url () in the < Base href = "<?php echo base_url ();? > "/> tag inside, so in
The page inside the call is more convenient.
Copy Code code as follows:
< Base href = "<?php echo base_url ();? > "/>
<script src= "Resource/aaa.js" ></script>