How can I create a javascript badge or widget?

前端 未结 5 1239
鱼传尺愫
鱼传尺愫 2021-01-14 09:38

I want to create a javascript badge that displays a list of links. We host the javascript on our domain. Other sites can put an empty div tag on their page and at the botto

5条回答
  •  不思量自难忘°
    2021-01-14 10:04

    It took me some time to find this answer on Stackexchange because I was using different search terms. I believe that the link suggested there is a more complete answer than the ones already given here:

    How to build a web widget (using jQuery)

    It covers:

    • ensure the widget’s code doesn’t accidentally mess up with the rest of the page,
    • dynamically load external CSS and JavaScript files,
    • bypass browsers’ single-origin policy using JSONP.

提交回复
热议问题