Click here to Skip to main content
16,004,686 members
Home / Discussions / Web Development
   

Web Development

 
Generalget image from web page Pin
paulred21-Jun-05 10:49
paulred21-Jun-05 10:49 
GeneralRe: get image from web page Pin
minhpc_bk22-Jun-05 22:36
minhpc_bk22-Jun-05 22:36 
Questionhow to get text in a combobox Pin
BlackDice21-Jun-05 9:58
BlackDice21-Jun-05 9:58 
AnswerRe: how to get text in a combobox Pin
minhpc_bk22-Jun-05 18:01
minhpc_bk22-Jun-05 18:01 
GeneralBrowser Detect Pin
Rob Tomson21-Jun-05 8:47
Rob Tomson21-Jun-05 8:47 
GeneralRe: Browser Detect Pin
NeverHeardOfMe21-Jun-05 13:14
NeverHeardOfMe21-Jun-05 13:14 
GeneralRe: Browser Detect Pin
Rob Tomson21-Jun-05 14:03
Rob Tomson21-Jun-05 14:03 
GeneralJavascript, Remote Window Close, Firefox and IE Pin
Glenn E. Lanier II21-Jun-05 3:41
Glenn E. Lanier II21-Jun-05 3:41 
Hi, I want to open a new browser window, let the user use that window for several minutes, and when they close, I'd like to change the page displayed in the original window.

According to numerous articles found Googling, this should work, but on my WinXP system, using Firefox and IE, I get nothing (when allowing pop-ups, if pop-ups are disabled, IE reports the window is closed, Firefox gives a JS error on checking the window handle). No JS errors, no notifications, nothing. Any pointers would be appreciated.

File 1 contains the code I'm using to open the window, to check for closure, and a form textarea that I update with the time (mostly so I know my timer is firing properly).

---- FILE 1 BEG ----
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><br />
<html><br />
<head><br />
<title>Opener Page</title><br />
</head><br />
<body><br />
<h1>Opener</h1><br />
<form name="frmOutput"><br />
<textarea name="txtOutput" rows=5 cols=80></textarea><br />
</form><br />
<p><a href="javascript:stopChecking();">Stop Checking</A></p><br />
<script language="Javascript"><br />
	log("Start", true);<br />
<br />
	var remoteWin = window.open("Remote.html", "remote", 'toolbar=no, location=no, directories=no, status=yes, menubar=no, width=795, height=500, resizable=yes, scrollbars=yes, screenx=0, screeny=0, top=0, left=0');<br />
	var timer = null;<br />
<br />
	function checkClosed()<br />
	{<br />
		log("Checking...", false);<br />
   	timer = setTimeout("checkClosed()", 5000);	// Check every 5 seconds.<br />
		if (!remoteWin)<br />
		{<br />
			alert("Window no longer exists");<br />
			stopChecking();<br />
		}<br />
		else if (remoteWin.Closed)<br />
		{<br />
			alert("Window Closed");			<br />
			stopChecking();<br />
		} <br />
	}<br />
<br />
	timer = setTimeout("checkClosed()", 5000);	// Check every 5 seconds.<br />
<br />
<br />
function stopChecking()<br />
{<br />
	log("Stop checking.", false);<br />
	clearTimeout(timer);<br />
}<br />
<br />
<br />
function log(sText, bClearContents)<br />
{<br />
	var d = new Date();<br />
	var s = d.getFullYear() + "." + d.getMonth() + "." + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + " " + sText + "\r\n";<br />
	if (bClearContents)<br />
	{<br />
		document.frmOutput.txtOutput.value = s;	<br />
	}<br />
	else<br />
	{<br />
		document.frmOutput.txtOutput.value = s + document.frmOutput.txtOutput.value;<br />
	}<br />
}<br />
</script><br />
<br />
<br />
</body><br />
</html><br />
<br />

---- FILE 1 END ----

File 2 contains some filler text. I can not change the source of this window (when live).
---- FILE 2 BEG (remote.html) ----
<br />
<html><head><title>Remote</title></head><body><h1>Remote Window</h1><p>Closing me should alert the original window or allow the original window to know when I <a href="javascript:window.close();">close</a>.</p></body></html><br />

---- FILE 2 END (remote.html) ----

TIA.

Confused | :confused: Glenn Confused | :confused:
GeneralRe: Javascript, Remote Window Close, Firefox and IE Pin
J4amieC21-Jun-05 5:01
J4amieC21-Jun-05 5:01 
GeneralRe: Javascript, Remote Window Close, Firefox and IE Pin
Glenn E. Lanier II21-Jun-05 5:17
Glenn E. Lanier II21-Jun-05 5:17 
GeneralRe: Javascript, Remote Window Close, Firefox and IE Pin
Mattias Olgerfelt21-Jun-05 6:02
Mattias Olgerfelt21-Jun-05 6:02 
GeneralRe: Javascript, Remote Window Close, Firefox and IE Pin
Glenn E. Lanier II21-Jun-05 7:17
Glenn E. Lanier II21-Jun-05 7:17 
GeneralPrinting the background color of an HTML page while printing Pin
MaheshKumarV21-Jun-05 0:01
MaheshKumarV21-Jun-05 0:01 
GeneralWeb Envrionment Pin
LiYS20-Jun-05 21:42
LiYS20-Jun-05 21:42 
GeneralRe: Web Envrionment Pin
minhpc_bk20-Jun-05 23:08
minhpc_bk20-Jun-05 23:08 
GeneralRe: Web Envrionment Pin
LiYS20-Jun-05 23:29
LiYS20-Jun-05 23:29 
GeneralRe: Web Envrionment Pin
minhpc_bk20-Jun-05 23:44
minhpc_bk20-Jun-05 23:44 
GeneralRe: Web Envrionment Pin
LiYS21-Jun-05 0:04
LiYS21-Jun-05 0:04 
GeneralRe: Web Envrionment Pin
minhpc_bk21-Jun-05 0:14
minhpc_bk21-Jun-05 0:14 
GeneralRe: Web Envrionment Pin
LiYS21-Jun-05 0:21
LiYS21-Jun-05 0:21 
GeneralRe: Web Envrionment Pin
minhpc_bk21-Jun-05 0:32
minhpc_bk21-Jun-05 0:32 
GeneralRe: Web Envrionment Pin
LiYS21-Jun-05 0:42
LiYS21-Jun-05 0:42 
GeneralRe: Web Envrionment Pin
fakefur29-Jun-05 14:22
fakefur29-Jun-05 14:22 
GeneralRe: Web Envrionment Pin
Matt Gerrans23-Jun-05 10:14
Matt Gerrans23-Jun-05 10:14 
GeneralRe: Web Envrionment Pin
minhpc_bk23-Jun-05 17:47
minhpc_bk23-Jun-05 17:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.