Conditional loading

Conditional loading

predrag.musicpredrag.music Posts: 8Questions: 0Answers: 0
edited April 2012 in General
How to load datatables from Microsoft CDN and if it doesn't load from CDN then load from local environment. Something like with jQuery:

[code]
!window.jQuery && document.write(unescape('%3Cscript src="http://www.my_domain.com/javascript/jquery.min.js'))
[/code]

but for DataTables.

Thnx.

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    Rather than checking for window.jQuery you can check for jQuery.fn.dataTable - if that doesn't exist, then load the local copy.

    Good thinking that :-)

    Allan
This discussion has been closed.