我正在使用下一个代码打开新窗口:
window.open(url,pageName1,"menubar=1,resizable=1,scrollbars=1,status=yes,width=1050,height=820");
所以窗口不是模态的
在新窗口中我打电话:
if (window.opener) window.opener.focus();
在 IE、Chorme、FF3.6 父窗口中成为焦点,但不在 FF5 或 FF6 中,我如何将焦点移到父窗口?
我正在使用下一个代码打开新窗口:
window.open(url,pageName1,"menubar=1,resizable=1,scrollbars=1,status=yes,width=1050,height=820");
所以窗口不是模态的
在新窗口中我打电话:
if (window.opener) window.opener.focus();
在 IE、Chorme、FF3.6 父窗口中成为焦点,但不在 FF5 或 FF6 中,我如何将焦点移到父窗口?
FF4+默认防止窗口升高和降低,您可以在选项中启用:工具->选项->内容->高级...(在“启用JavaScript”行)->勾选“升高或降低窗口”
我将在这里留下我对任何想在后台打开弹出窗口的人的贡献。秘诀是打开一个空白页面,然后注入所需的 url。
<script>
var url = 'http://example.com/page.html';
var popunder = w.open('about:blank',"window_example", "resizable=no,scrollbars=yes,height=600,width=800,status=yes,top=0,left=0");
if(window.navigator.userAgent.match(/firefox/i)){ //fix for firefox browser
popunder.document.write('<script type="text/javascript">window.opener.open("","_parent");location.replace("'+url+'");</script>');
popunder.document.close();
} else
popunder.parent.location = url;
popunder.blur();
window.focus();
</script>