Code Monkey home page Code Monkey logo

Comments (5)

zytzagoo avatar zytzagoo commented on September 13, 2024

Can you create a jsfiddle (or similar, the point is to create a reduced test case) showing your way of doing async mode loading (and the banner then not appearing)?

from cookie-banner.

lomanq avatar lomanq commented on September 13, 2024

Thank you for the answer. I tried in this way: http://jsfiddle.net/o7cr4o6d/1/

If i tried in jsfiddle, with this async mode the banner appeared, but in wordpress it doesn't. Are there other way to load it?

from cookie-banner.

zytzagoo avatar zytzagoo commented on September 13, 2024

Cool, that's progress (kind of).

It suggests there might be some other scripts queued in WP that are causing conflicts (or even errors). Most likely from your theme and/or plugins. Are there any errors in the console when you try it in WP?

Yes, there are other ways to run/invoke the banner. Load the JS in a <script> tag without id="cookiebanner" (that way it will not auto-start). Then you can create a new Cookiebanner() "instance" yourself and call run() on it (for example from jQuery's ready() function or similar).

You'll just have to configure it completely using a JS object yourself -- see how the tests are done.

from cookie-banner.

lomanq avatar lomanq commented on September 13, 2024

It seems that there are no errors. Very interesting the way you suggested. So, i want to try last chance.
I load the JS in script tag with async and remove the "id=cookiebanner". In this way Google PageSpeed is ok! Then how can i proceed ?

Sorry but i'm not a developer, can you update my jsfiddle with code to load new jQuery instance? http://jsfiddle.net/o7cr4o6d/2/

Thank you :)

from cookie-banner.

zytzagoo avatar zytzagoo commented on September 13, 2024

Something along the lines of http://jsfiddle.net/o7cr4o6d/3/ should hopefully work (once the reference to ../cookie-banner.js is working, obviously, and jQuery is loaded)

from cookie-banner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.