how to decide if the external js is loaded

try to figure out if the external js lib is loaded:


<script language="javascript">
var len = $('script[src="<external JS>"]').length;
if (len === 0) {
    $.getScript('<external JS>');
}
</script>

你可能感兴趣的:(JavaScript)