Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Loading JS that block all the rest of the page loading... (FireFox)

SpongeBOB

Well-Known Coder
Hi everyone,

In my page I have something like :
HTML:
<!DOCTYPE html>
<html lang="en">

<head>
    <title>A title</title>
    <meta charset="utf-8"> 
    <script src="https://something.com/JS/"></script>
</head>

But if for any reason the
<script src="https://something.com/JS/"></script>
can't load on the user Internet browser ex: (firewall, something.com offline etc..)

Then the loading and CSS animation ! (WTF) of the page is on hold until (I assume) the browser timeout trigger and the rest of the page continue to load.
I've try to put the script at the bottom of the HTML code but doesn't help,

neither: <script src="https://something.com/JS/" type="module" async></script>

Any ideas ?
 
I don't think js checks to see if it's loaded. But here's a thought. Set a global variable in the script and check it in a different script - if it is not set you know it didn't load.
 
@OldMan , It's in the browser where lay the problem/solution.. more exactly who can I specify that this .js file shuold not block the rest, or be loaded at the end.

I have tried:
  • async
  • defer
  • type="module"
  • Placing the <script> at the end.

but nothing seem to work..

I should ask on a dedicated Firefox forum, but it seem not existing !?
 
Last edited:

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom