你如何从HTA内检测window.open(...)?
-
27-09-2019 - |
题
我正在开发将运行在我们的接待区亭的HTA。这个信息亭可以显示启动使用window.open()方法新视窗网络页面。
我想要做的就是手柄window.open()从我的HTA内,所以不是产卵的Internet Explorer窗口,新的窗口将出现在HTA内浮动的iframe。
任何想法,我怎么会去这样做?
下面是示出了理想的情况下(尽管我知道实际的解决方案可能会被更复杂的)一些伪代码。
function onWindowDotOpen(obj)
{
spawnNewIframeTab(obj); // Handle the event in the HTA
return false; // Stop the default behaviour from firing
}
是否有一个VBScript溶液在所有?
解决方案
我通过重写所加载的IFRAME的“window.open”我的解决特定问题。为此,您可以在HTA,但它不会在常规浏览器的工作。
<iframe onload="iframe_onload(this)" src="..."...></iframe>
<script type="text/javascript">
iframe_onload = function(obj)
{
$(obj).contents().get(0)
frame.frames.window.open = function(url, name, features, replace)
{
...
}
}
</script>
不隶属于 StackOverflow