Bookmarklet wait until Javascript is loaded

前端 未结 4 1783
一个人的身影
一个人的身影 2020-12-04 16:58

I\'ve got a bookmarklet which loads jQuery and some other js libraries.

How do I:

  • Wait until the javascript library I\'m using is available/loaded. If
4条回答
  •  盖世英雄少女心
    2020-12-04 17:47

    To answer your first question: Javascript is interpreted sequentially, so any following bookmarklet code will not execute until the library is loaded (assuming the library was interpreted successfully - no syntax errors).

    To prevent the files from being cached, you can append a meaningless query string...

    url = 'jquery.js?x=' + new Date().getTime();
    

提交回复
热议问题