jQuery Plugin To Prevents A Script From Being Loaded More Than Once

File Size: 112KB
Views Total: 684
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Prevents A Script From Being Loaded More Than Once

getScriptOnce is an useful and lightweight jQuery plugin used to prevent a script from being loaded more than once via $.getScript(). It works like PHP's require_once function.

How to use it:

1. Include the latest jQuery javascript library on your web page.

<script src="http://code.jquery.com/jquery-1.10.3.min.js"></script>

2. Include jquery.getscriptonce.js script on your web page, after jQuery library.

<script src="dist/jquery.getscriptonce.js"></script>

3. Usage.

$(document).ready(function() {
    
$.getScript('YOUR-SCRIPT.js');
    
});

About author:

Author: Loran Kloeze

Homepage: https://github.com/invetek/jquery-getscriptonce


This awesome jQuery plugin is developed by invetek. For more Advanced Usages, please check the demo page or visit the official website.