我正在尝试在ajax成功处理程序中的本地主机中打开google
页面。这就是我到目前为止的尝试。
$(".write-portal").off("click").on("click",function (event) {
var id = $(this).attr('id');
var pageId = $(this).attr('data-pageBodyId');
var windowUrl= window.location.href;
var postData={"windowUrl":windowUrl};
$.ajax({
type : "POST",
url : contextpath + "/perform-logout",
data : postData,
async:false,
success : function(msg) {
window.open("www.google.com","google",'width=700,height=600,left=0,top=100,screenX=0,screenY=100')
//window.location.href = "www.google.com";
/*if(msg){
window.location.assign(customUrl);
}*/
},
error : function(xhr, ajaxOptions, thrownError) {
}
});
});
它会弹出一个弹出窗口,但网址为contextpath + www.google.com
。但我只想要www.google.com
答案 0 :(得分:1)
打开窗口时需要使用绝对URL。试试这个:
window.open("http://www.google.com", ...