Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 15th, 2005, 09:47 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default Close all popup windows on javascript redirect

I have this JavaScript file called countdown.js.

I add
Code:

<body onLoad="InitializeTimer();">
to any page that i want the script to run. When it re-directs me to session_logout.asp is there any way that i can close any pop-up windows that have been opened while signed in with this session? I am using ASP sessions as per this code below:

Code:
companyid = Session("companyid")
Code:
<SCRIPT LANGUAGE = "JavaScript">

// Script to warn user when there are sixty seconds of their logout time left
// and then send user to login after eight minutes have elapsed 
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 1740
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function redirectFrame(){
    top.location="session_logout.asp?logout=false";
}

function StartTheTimer()
{
    if (secs == 0 ){

        self.status = "Seconds until GDS Session Timeout " + secs
        StopTheClock()

        alert("Your session has expired, you will now be redirected to login.")
        setTimeout('redirectFrame()',1000);

    }
    else if (secs <= 60){
        //self.status = "Seconds until GDS Session Timeout " + secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
        else{
            secs = secs - 1    
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
        }
}
//-->
</SCRIPT>

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old June 23rd, 2005, 04:41 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

This is session_logout.asp

Code:

<SCRIPT language="JavaScript">
<!--
function closeAllPopups(){
  //closePopup("any"); //printBooking.asp
  closePopup("name"); //fare_details.asp
  //...close other popups here
}

function closePopup(popupName){
    var win = window.open("", popupName, "width=1, height=1"); //set small window if in case popup is not yet existing
    win.close();
}

window.onload = closeAllPopups;

 function redirectFrame()
   {
    top.location="../login.asp";
   }

     alert("Thank you for using CRMPicco.");
     setTimeout('redirectFrame()',1000);

//-->
</SCRIPT>

How do i only run this line

Code:
alert("Thank you for using CRMPicco.");
if the window name is not 'name'?

TIA.

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply With Quote
  #3 (permalink)  
Old July 1st, 2005, 09:44 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

or if there are no pop-ups open at the time?

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply With Quote
  #4 (permalink)  
Old September 5th, 2007, 04:37 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am using popup window ,my query is when session expires it should be diverted to sessionExpir.aspx

page automatically.

1. please detail me where closeAllPopups() function will be called.
how andd where this function will get called when session expires?????

Please Help????????
Code:

<SCRIPT language="JavaScript">
<!--
function closeAllPopups(){
  //closePopup("any"); //printBooking.asp
  closePopup("name"); //fare_details.asp
  //...close other popups here
}

function closePopup(popupName){
    var win = window.open("", popupName, "width=1, height=1"); //set small window if in case popup

is not yet existing
    win.close();
}

window.onload = closeAllPopups;

 function redirectFrame()
   {
    top.location="../login.asp";
   }

     alert("Thank you for using CRMPicco.");
     setTimeout('redirectFrame()',1000);

//-->
</SCRIPT>

How do i only run this line

Code:
alert("Thank you for using CRMPicco.");
if the window name is not 'name'?


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a popup window janakiraman Javascript 0 June 25th, 2007 01:08 AM
Javascript in popup. rupen Javascript 0 April 27th, 2006 08:34 AM
Can a popup be programmed to close w/o IE warning? Pete L Javascript How-To 2 November 10th, 2005 07:56 AM
Open and close windows skicrud Javascript How-To 1 August 17th, 2004 04:03 PM
Popup Windows myAsp Classic ASP Basics 9 March 16th, 2004 05:03 PM



All times are GMT -4. The time now is 02:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.