Jump to content
[MUST READ] Forum Rules ×

Disable Single JavaScript File execution using code on your website


Recommended Posts

I am actually new on coding and searched but found nothing about this. 

Let's say I have a JavaScript file to be executed in my HTML/PHP file. How can I disable its execution using code (even with JavaScript itself) without removing it from the code?

I know it is useless for most cases; I just want to know if I can do that.

Link to comment
Share on other sites

  • 4 weeks later...
On 25/07/2018 at 5:53 PM, PCTipsGR said:

I am actually new on coding and searched but found nothing about this. 

Let's say I have a JavaScript file to be executed in my HTML/PHP file. How can I disable its execution using code (even with JavaScript itself) without removing it from the code?

I know it is useless for most cases; I just want to know if I can do that.

Please explain further in what situation you would need this. I might have an idea, but it depends on the situation.

Link to comment
Share on other sites

On 7/25/2018 at 10:53 PM, PCTipsGR said:

I am actually new on coding and searched but found nothing about this. 

Let's say I have a JavaScript file to be executed in my HTML/PHP file. How can I disable its execution using code (even with JavaScript itself) without removing it from the code?

I know it is useless for most cases; I just want to know if I can do that.

I missed this topic and to do this just add a logic such as :

var execute_code = true;

if(execute_code){
	// Code to be executed
  	// Change true to false skip code execution
}

 

Link to comment
Share on other sites

  • 4 weeks later...
On 2018/7/25 at 11:53 PM, PCTipsGR said:

I am actually new on coding and searched but found nothing about this. 

Let's say I have a JavaScript file to be executed in my HTML/PHP file. How can I disable its execution using code (even with JavaScript itself) without removing it from the code?

I know it is useless for most cases; I just want to know if I can do that.

Is it convenient to use e-mail to chat?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...