Use javascript to inject script references as needed?

后端 未结 6 840
终归单人心
终归单人心 2020-12-08 03:20

I have a JS function that may occasionally get used on some pages. It is dependent on another JS file (swfObject.js), but I\'d like to avoid having to include this file all

6条回答
  •  轮回少年
    2020-12-08 03:52

    If you're using a higher level framework such as JQuery, you could check out the $.getScript(url, callback) function.

提交回复
热议问题