Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object required: 'window'

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
I am trying to implement a way of handling the fact that I have set the users session to timeout after 20 minutes. I would like to place a piece of code at the top of a page that checks if a session object exists - session("login") in this case. If it doesnt, the timeout.htm page should be opened and the user asked to login in again.

The following code gives this error "Object required: 'window' "

<%
if not session(&quot;login&quot;) then
dim NewWindow

set NewWindow = window.open timeout.htm&quot;,&quot;subWind&quot;,&quot;height=200,width=400,status=yes, toolbar=no,menubar=no,location=no&quot;)
newwindow.focus()

end if
%>

I have tried specifying that the script is vbscript within script tags but then the session object cannot be referenced.

Any ideas on how I can get this working?

Thanks in advance
jan
 
hey there is no window object in ASP. There is no need to open a window at the top if session has expired .. u can show that login page in the existing browser only...
use:
<%
if not session(&quot;login&quot;) then
dim NewWindow

response.redirect(&quot;timeout.htm&quot;)
end if
%>

But if u insists that u have to open a new window then use:

<%
if not session(&quot;login&quot;) then
dim NewWindow
%>
<script language=&quot;JavaScript&quot;>
var NewWindow = window.open(&quot;timeout.htm&quot; ,&quot;subWind&quot;,&quot;height=200,width=400,status=yes, toolbar=no,menubar=no,location=no&quot;)
newwindow.focus()
</SCRIPT>
<%
end if
%>




 
Thanks for your help.

The reason I am trying to open a new window is that the page current displayed continas frames. If I simply redirect to a new page, that page opens in one of the frames - not what I want!

Maybe my question should be, how do I redirect and have the page open fully within the current browser (not just within one of the frames)?

Thanks again
jan
 
you could use
Code:
if not session(&quot;login&quot;) then
	Response.Write(&quot;<html><body onload=&quot;&quot;top.location=timeout.htm&quot;&quot;></body></html>&quot;)
	Response.End
end if
or in your timeout.htm file put
Code:
<SCRIPT LANGUAGE=javascript>
<!--
if (top.location != location)
	top.location = location;
//-->
</SCRIPT>
at the top [pipe]
 
Thank you so much - works perfectly :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top