Good time of day. How can you enable or disable the action of a script, be it jQuery or simple js ... Example: jQuery script gives "beautiful, effects ...", you need to disable effects in the settings on the site disable or enable only specific scripts for an individual user

  • save data in cookies or local storage and when loading use in your scripts - Specter
  • More the question is not how to configure for each user, but how to enable / disable - jkwe45

3 answers 3

You and suggest on the server side to write this (option for php):

<? if($enableScripts) { ?> <script src="js/jquery.js" /> .... <? } ?> 
  • and what instead of $ enableScripts to write? - jkwe45
  • This is your variable that is responsible for turning off effects on the site. Because you need to know for each user which scripts to connect, then all this should be stored in the database and retrieved from there when authorizing the user. Then see what scripts this user has connected to and upload the corresponding .js files in php - nMike

This should be done on the server side. I do not know what the server part is written on, but on the page where the scripts are connected you need to do something like this:

 <% if(settings.enableScripts) { %> <script src="js/jquery.js" /> .... <% } %> 
  • Alas, the page on php ((( - jkwe45
  • This option is not suitable ?? <? if ($ enableScripts) {?> <script src = "js / jquery.js" /> .... <? }?> - nMike

Look at yepnopejs if you need dynamic client-side script loading logic.