CSP網站安全策略html
var _e = new Event('input') document.getElementsByTagName('input')[4].value = '張' document.getElementsByTagName('input')[4].dispatchEvent(_e)
window.addEventListener('message', function(rs){ console.log(rs); if (rs.origin === 'https://test.auto0917.com') { } }); var iframe = document.createElement("iframe"); document.querySelector("body").appendChild(iframe); iframe.setAttribute("src","https://test.auto0917.com/test.html");
注意子頁面發送消息時會有同源策略問題,全部必須用top.postMessage,不能用parant.posgit
window.top.postMessage('hahah', 'https://appleid.apple.com/account#!&page=create')
blesstosam 的 github github