原生js中jsonp跨域实现调用必应每日壁纸API Tips: 注意jsonp跨域需要后台支持。 必应壁纸接口: https://github.com/xCss/bing 1234567891011function setBingImage(){ let script = document.createElement('script'); bing = { bg: function (data) { body.style.backgroundImage = `url('${data.data.url}')`; } } script.src = `https://bing.ioliu.cn/v1/?d=0&w=1920&h=1080&callback=callback`; document.querySelector("head").appendChild(script); document.querySelector("head").removeChild(script);} 代码片段 > JavaScript 原生js中jsonp跨域实现调用必应每日壁纸API https://blog.virs.xyz/2020/02/05/233/ 作者 Vir 发布于 2020年2月5日 许可协议 原生js module中的函数无法在HTML中绑定解决方案 上一篇 使用JSONP跨域失败问题解答 下一篇