Monday, December 23, 2024 4:56:13 AM

How to load tawk.to script in mobile size only?

1 year ago
#628248 Quote
Solutions

Create a function to load the javascript

function loadScript() {
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.text = "var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date()";
            script.src = "https://embed.tawk.to/54cfadabb37d8bc7b1a9863f/default";
            script.charset = "UTF-8";
            script.setAttribute("crossorigin", "*");
            script.async = true;
            document.body.appendChild(script);
}

When page load than check the window.innerWidth that if its greater than 600 then call the loadScript()

  $(document).ready(function () {
            if (window.innerWidth > 600) {
                loadScript();
            }
        });
0
5 months ago
#628257 Quote
I recently tried Paymetodoyourhomework, and the quality of their service exceeded my expectations. The essay was well-researched and delivered on time. For those curious about how this platform can help, I highly recommend exploring their offerings. Discover more about their top-notch academic assistance today!
0