Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何防止弹出窗口重定向到父屏幕?_Javascript_Jquery_Html_Popup - Fatal编程技术网

Javascript 如何防止弹出窗口重定向到父屏幕?

Javascript 如何防止弹出窗口重定向到父屏幕?,javascript,jquery,html,popup,Javascript,Jquery,Html,Popup,单击按钮时,我使用window.open()生成一个弹出窗口 生成弹出窗口的单击按钮位于social.html中 我的密码是 $.get(url).success(function(req) { var win=window.open('','_blank','width=700,height=500,top=0,left(screen.width-700)'); win.document.write('<link rel="stylesheet" href="/css/m

单击按钮时,我使用window.open()生成一个弹出窗口

生成弹出窗口的单击按钮位于social.html中

我的密码是

$.get(url).success(function(req)
{
    var win=window.open('','_blank','width=700,height=500,top=0,left(screen.width-700)');
    win.document.write('<link rel="stylesheet" href="/css/mycss.css" />' + req);
    win.document.close();

});
$.get(url).success(函数(req)
{
var win=窗口打开(“空白”,“宽度=700,高度=500,顶部=0,左侧(屏幕宽度-700)”;
win.document.write(“”+req);
win.document.close();
});
我正在将ajax调用响应(包含html代码)写入弹出窗口。 弹出窗口中的内容有许多外部链接,在不同的窗口中打开(再次使用window.open)并正常工作。问题是, 当我点击任何链接时,弹出窗口将重定向到social.html。它不应该重定向


请帮助我,我试过了,但找不到解决方案

这不应该发生。我试过你提到的。 请检查链接的href属性,可能存在相对路径

尝试在锚定标记的href属性中提供完整路径(绝对路径)。 或者可能有任何重定向规则(htaccess或php)阻止它打开弹出窗口上的链接。 谢谢