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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force closure of a window

Status
Not open for further replies.

ChetN

Technical User
Feb 9, 2001
42
US
How can I prevent a window from being minimized?

I created a small window for a password routine which displays in the center of the screen, overlapping the initial window. My consternation is if the user clicks anywhere off the display, the window is minimized to an icon at the bottom of the browser window. I would prefer that the only way to close this small window is either a "close.window" option, or by clicking the X at the top of the window.

I already checked keywords in several combinations and could not find any past postings and solutions.
 
I auto-close the window in 30 seconds, so if they minimize, it'll close itself (which reloads the main window)...

<script>
var timeLeft = 31 //seconds
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
var closed = false;
function closeWin(message){
if (! closed){
window.resizeTo(20,20)
window.opener.focus()
if (message != &quot;&quot;){
window.opener.alert (message)
}

locName = window.opener.location.toString()
quesFound = locName.indexOf(&quot;?&quot;)
if (quesFound== -1){
locName = locName + &quot;?cbr=<%=cbr%>&quot;
}
else{
cbrFound = locName.indexOf(&quot;cbr&quot;)
if (cbrFound < locName.length - 13){
locName += &quot;<%=cbr%>&quot;
}
}
window.opener.location = locName
closed = true
self.close()
}
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
function startTimer(){
timeLeft --
if (timeLeft < 0) {
closeWin(&quot;&quot;)
}
minsLeft = Math.floor(timeLeft / 60)
secsLeft = timeLeft - (minsLeft * 60)
if (secsLeft < 10){
secsLeft = &quot;0&quot; + secsLeft
}
document.pageForm.timer.value = minsLeft + &quot;:&quot; + secsLeft
timerID = setTimeout(&quot;startTimer()&quot;,1000)
}

<body onLoad=&quot;startTimer()&quot;> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top