问题
I know for append new css or js file I can use Asset class. But if i want check if css or js files are present before Asset?? There is a way? Thx
回答1:
you can assign ids to your assets as you bring them in and check against the dom for their presence:
Asset.javascript("https://github.com/DimitarChristoff/tippable/raw/master/Source/tippable.js", {
id: "someid",
onload: function() {
alert("loaded");
if (document.id("someid"))
alert("already loaded");
}
});
来源:https://stackoverflow.com/questions/5238117/mootools-check-for-css-or-js-files