• Resolved Serhii PHP

    (@serhii18)


    It seems that changing the src attribute after loading a page does not load the delayed script. Attribute src changes, but the script does not load.

    Here is a quote from the html specification

    Changing the src, type, nomodule, async, defer, crossorigin, integrity, and referrerpolicy attributes dynamically has no direct effect

    When I change the this piece of code

    function loadScripts() {
      document.querySelectorAll("script[data-type='lazy']").forEach(function(elem) {
        elem.setAttribute("src", elem.getAttribute("data-src"));
      });
    }

    to another piece of code

    function loadScripts(){
        document.querySelectorAll("script[data-type='lazy']").forEach(function(elem){
            var newScript = document.createElement("script");
            newScript.src = elem.getAttribute("data-src");
            document.body.appendChild(newScript);
            elem.remove()
        })
    }

    everything works.

    I can’t send a link to the site because it’s my local development server.
    Maybe you have some demo site with working Flying Scripts where I can test my browser?

    Thanks

    • This topic was modified 4 years, 5 months ago by Serhii PHP.
    • This topic was modified 4 years, 5 months ago by Serhii PHP.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Doesn’t work in Firefox 94.0 and Chrome 96.0 Ubuntu’ is closed to new replies.