简体   繁体   中英

my javascript is not loading in order

I think I'm going crazy, all my searches indicate I am doing this properly, but I am still getting the opposite results. I have two scripts. The first one is the library (RecordRTC), and the second one is my javascript using the library. No matter what I do, my script loads first - and the library loads second. And my browser keeps showing (in the timeline) that this is true, and my script keeps showing the error "RecordRTC not defined" - that my script is calling the library before it has loaded.

Below is ALL the html code I'm using. Please send help.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Testing RecordRTC</title>
<script type='text/javascript' src="http://RecordRTC.org/latest.js"></script>
</head>
<body>
    <div id="videos-container">
        <video id="video"></video>
    </div>
  <script type='text/javascript' src="./js/videos02.js" defer></script>
</body>
</html>

Use a validator .

async and defer are boolean attributes. They are either present or they are omitted. You cannot give them the values true and false . async=false is an error that will be error corrected to async is on for this script .

The library is being called before it is loaded because you have said that it can be loaded async and defer so the browser isn't waiting for it before loading the other script.

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