Reputation: 7707
I have a page where I am getting session values then calling form action through javaScript, please see the code below
<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>SessionRedirect</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">
<form method="post" name="frmRedirect" target="_blank">
<input type="hidden" name="email" value="<%=Session["Email"].ToString() %>" />
<input type="hidden" name="pass" value="<%= Session["PWD"].ToString() %>" />
<input type="hidden" name="User" value="<%= Session["User"].ToString() %>" />
</form>
<script type="text/javascript">
if(frmRedirect.User.value == "P")
{
frmRedirect.action = "http://cmsstag/partnerzone/index.aspx";
}
else
frmRedirect.action = "http://cmsstag/studentportal/index.aspx";
document.frmRedirect.submit();
location.replace("index.aspx");
</script>
<%
Session.Remove("registration");
Session.Remove("User");
Session.Remove("UserId");
Session.Remove("UserLoggedIn");
Session.Remove("AgentCode");
Session.Abandon();
%>
</body>
</html>
Now I want to open page in new window with size given by me when I use "frmRedirect.action" used in above code.
Upvotes: 0
Views: 3231
Reputation: 105069
This is a rather complicated example. What you could try is:
window.open()
and set its dimensions and namewindow.open()
I've tried it. It works.
Edit
This is the code for you. Maybe you will have to set some time between opening a new window and submitting a form to make sure the window is already created (use setTimeout
).
// open a new window with proper size
window.open("", "MySubWindow", "height=480,width=640");
// do your action assignments
frmRedirect.target = "MySubWindow";
frmRedirect.submit();
location.replace("index.aspx");
Upvotes: 3