将 iframe 拆分为单独的 url 的正确 javascript 语法是什么?即,我在 iframe 中有一个页面,上面有一个表单,在提交该表单后,我想重定向到站点上的单独页面(同一域),但在父窗口而不是 iframe 内打开它。这是我尝试过的:
protected void ReplacePageClick(object sender, EventArgs e)
{
string url = "Contact.aspx";
ClientScriptManager cs = Page.ClientScript;
cs.RegisterClientScriptBlock(this.GetType(), "RedirectScript", "top.document.location.href = " + url, true);
//top.document.parent.location.href?
//top.document.location.replace?
//window.parent.location?
//window.top.location.href?
//window.top.location.replace?
//parent.window.location.href?
//top.location.href?
// the below works, so we know it's able to register javascript
//cs.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('hello')", true);
}