我有这个HTML代码:
<html>
<head>
<script type="text/javascript">
function GetDoc(x)
{
return x.document ||
x.contentDocument ||
x.contentWindow.document;
}
function DoStuff()
{
var fr = document.all["myframe"];
while(fr.ariaBusy) { }
var doc = GetDoc(fr);
if (doc == document)
alert("Bad");
else
alert("Good");
}
</script>
</head>
<body>
<iframe id="myframe" src="http://example.com" width="100%" height="100%" onload="DoStuff()"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
问题是我收到消息"Bad".这意味着iframe的文档没有正确获取,GetDoc函数返回的实际内容是父文档.
如果你告诉我哪里弄错了,我会很感激.(我希望在IFrame中托管文档.)
谢谢.
我知道WinAPI具有内置的黑客功能.
我甚至在带有Pinvoke的C#中使用它们......要破解Minesweeper ......很容易......所以...
我如何保护我的应用程序免受进程内存编辑,拒绝DLL注入和其他黑客方式.怎么样?!
希望WinAPI有类似无效的东西DontTouchMeOrIWillTerminateYou(bool protect)......