- 避免在iframe上执行js,return需要配合外面的function
if (window.top != window.self){//don't run on frames or iframes
confirm('Detected iframe, now return.');
return;
}
- 找回alert,反击名字被重定义
(function(){//召唤alert
var temp_frame = document.createElement('iframe');
document.body.appendChild(temp_frame);
window.fuck = temp_frame.contentWindow.alert;
})()
- 测试时间以判断性能
console.time();
for(let i=0;i<10000;i++){
//code
}
console.timeEnd();