C# 将父页面重定向到fancybox内部提交时的指定url
我正在使用fancybox,在提交表单后,我想将我的父页面重定向到指定的url,我正在使用fancybox,如下所示C# 将父页面重定向到fancybox内部提交时的指定url,c#,jquery,asp.net,fancybox,C#,Jquery,Asp.net,Fancybox,我正在使用fancybox,在提交表单后,我想将我的父页面重定向到指定的url,我正在使用fancybox,如下所示 $(document).ready(function () { $('[id*=addnewRequest]').fancybox({ 'width': 760, 'height': 540, 'padding': 0, 'mar
$(document).ready(function () {
$('[id*=addnewRequest]').fancybox({
'width': 760,
'height': 540,
'padding': 0,
'margin': 0,
'hideOnOverlayClick': false,
'scrolling': 'auto',
'autoScale': false,
'transitionIn': 'none',
'transitionOut': 'none',
'type': 'iframe',
'centerOnScroll': true,
'onClosed': function () {
if ($.redirTo != null && $.redirTo.length > 0){
window.location.replace($.redirTo);
}
else {
parent.location.reload(true);
}
}
});
});
提交表单后,我使用下面的注册脚本,其中“redirectTo”是我希望父页面重定向的url
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "add", "parent.jQuery.redirTo='" + redirectTo + "'; parent.jQuery.fancybox.close();", true);
现在,我的父页面将如何重定向到相应的url。知道吗
谢谢,提交表单后,您可以直接调用
window.top.location.href
,新url为:
window.top.location.href = "http://www.urltogo.com/pagetomove.aspx";
避免在父级上发送参数,并从父级进行重定向
下面是一个例子(我加上5秒的延迟以便有时间看到它)
或
您的线路可能是:
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "add", "window.top.location.href ='" + redirectTo + "'; parent.jQuery.fancybox.close();", true);
我也祝你新年快乐。除了IE,我所有的浏览器都可以打开我的盒子。当我使用IE时,它直接在当前窗口中打开页面以代替fancybox@GurbaxSinghBhangal仅在ie上尝试
top.location.href
,查看是否works@GurbaxSinghBhangal还要检查window.top.location
或top.location
是否在IE上工作(不带href)@gurbaxsingbhangal在我的IE(第8版)上出于某种原因工作很好用。