
hello.js
function hello(){
alert('hello');
}
hello.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script id="hello" src="hello.js"></script>
</head>
<body>
</body>
<script>
hello();
if (-[1,]) {
document.getElementById('hello').remove();
} else {
document.getElementById('hello').removeNode(true);
}
setTimeout(function(){
hello();
},1000);
</script>
</html>
会执行: Chrome,firefox,IE 11,Opera
不执行: Safari
暂时仅测试这些