硅基本上是你的JS代碼就可以了,
首先需要創建一個JS代碼,並將其託管到一些服務器通過獲取它得到它,所以像你的JS代碼託管到https://www.mygreatjscode.com/myjscode.js
所以,你的JS代碼會做休息,
這樣使用純JS(含未如jQuery等框架),讓您的myjscode.js
文件將包含此:
//create an autoexec function
(function(){
var body = document.getElementByTagName("body");
body = body ? body : false;
if (body){
var iframe = document.createElement("iframe");
iframe.setAttribute("id", "MY_CUSTOM_ID");
//here set the url that the iframe will be render
iframe.setAttribute("src", "https://stackoverflow.com/");
//finally insert into the body of page
body.appendChild(iframe);
}
})();
最後,您需要將腳本標記插入到您的網頁中,就像這樣
<script src="https://www.mygreatjscode.com/myjscode.js" data-customer="14532"></script>