Javascript 如何防止浏览器在iframe通过document.getElementById(';iframe346';).src=';https://www.bing.com/';
当我单击锚定标记时,它会在我的简单HTML页面中加载iframe,但我收到一条警告,浏览器阻止了弹出窗口。如何防止浏览器停止阻止弹出窗口 以下是我的片段: Html代码:Javascript 如何防止浏览器在iframe通过document.getElementById(';iframe346';).src=';https://www.bing.com/';,javascript,jquery,dom,popup,Javascript,Jquery,Dom,Popup,当我单击锚定标记时,它会在我的简单HTML页面中加载iframe,但我收到一条警告,浏览器阻止了弹出窗口。如何防止浏览器停止阻止弹出窗口 以下是我的片段: Html代码: <iframe id="iframe344" src="" title="YouTube video player"></iframe> <a onclick="iframe344()"
<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>
请帮助我社区不建议出于安全目的允许弹出窗口,但为了进行测试,您可以转到chrome->settings->site settings,搜索弹出窗口和重定向,并从那里允许它们。您不能。这是一个浏览器功能,可以阻止用户被恼人的弹出窗口轰炸。如果你能绕过这个限制,那它就完全没有意义了。若要解决此问题,请不要使用弹出窗口。如果我的答案对您有效,请向上投票
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);
}