通过document.getElementById('iframe346').src = 'https://www.bing.com/'; 如何防止浏览器在iframe加载时停止拦截弹窗
How to prevent browser to stop blocking pop up when iframe loads through document.getElementById('iframe346').src = 'https://www.bing.com/';
当我单击锚标记时,它会在我的简单 HTML 页面中加载 iframe,但我收到一条警告,提示浏览器阻止了弹出窗口。我怎样才能阻止浏览器停止阻止弹出窗口。
这是我的代码片段:
Html代码:
<iframe id="iframe344" src="" title="YouTube video player"></iframe>
<a onclick="iframe344()"
href="http://securedbd.com/path/out.php?sxid=0" target="_blank">
<img src="writing-animation.gif"
width="40px">
</a>
Javascript代码:
function iframe344() {
document.getElementById('iframe344').style.display = 'block';
document.getElementById("popup").style.display = "block";
document.getElementById('iframe344').src = 'https://www.bing.com/';
setTimeout(function () {
window.open("https://www.alexa.com/");
}, 1000);
}
请社区帮助我
出于安全目的,不建议允许弹出窗口,但为了您的测试,您可以转到 chrome->设置-> 站点设置并搜索弹出窗口和重定向并从那里允许它们。
当我单击锚标记时,它会在我的简单 HTML 页面中加载 iframe,但我收到一条警告,提示浏览器阻止了弹出窗口。我怎样才能阻止浏览器停止阻止弹出窗口。
这是我的代码片段:
Html代码:
<iframe id="iframe344" src="" title="YouTube video player"></iframe>
<a onclick="iframe344()"
href="http://securedbd.com/path/out.php?sxid=0" target="_blank">
<img src="writing-animation.gif"
width="40px">
</a>
Javascript代码:
function iframe344() {
document.getElementById('iframe344').style.display = 'block';
document.getElementById("popup").style.display = "block";
document.getElementById('iframe344').src = 'https://www.bing.com/';
setTimeout(function () {
window.open("https://www.alexa.com/");
}, 1000);
}
请社区帮助我
出于安全目的,不建议允许弹出窗口,但为了您的测试,您可以转到 chrome->设置-> 站点设置并搜索弹出窗口和重定向并从那里允许它们。