Skip to main content

Is it possible to disable a specific javascript (say, for a live chat feature) when the mobile version of a landing page is shown? 


I assume the answer is no since only the display elements are affected when the size of the screen changes.

Hi Jeff,


There’s no great way of doing this, but here’s something to try:


 if ( $(window).width() <= 600 ) {
// Your mobile code goes here
}else{
// Your desktop code goes here
}
</script>```

Whether this will work for you will depend on exactly how your script works. If it's some code on the page that you can drop into the 'Your desktop code goes here' section, great! But if it's a script tag that's used to run code from an external source you're out of luck.

I hope it helps!

Thanks,

yes, it’s work.


Reply