elementor4fun-logo
Last update: May 29, 2024

How do I prevent certain javascript from running inside the Oxygen editor?

Sometimes there is a situation when a certain script that you have inserted through Code Block causes problems in the Oxygen editor, or for some other reason you do not need this script to be executed in the editor. I want to show you a trick that I often use in such cases.

To block the execution of the script in the editor, sufficiently before the beginning of your script, insert the line if($('html').attr('ng-app') == 'CTFrontendBuilder') return; and the following code will not work..

Example of usage in Code Block:

jQuery(document).ready(function($) {

    if($('html').attr('ng-app') == 'CTFrontendBuilder') return;
	
    //Next, your code, which will work only in the public part of the site
	
});

That is all. It's simple. I hope the advice will help you.

Where exactly can this be needed? For example, when connecting Three.js, if you want to repeat this crazy tutorial from Supa Mike.

closealign-justifychevron-downcaret-up