[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can you solve this ?



Folks, please tell me what I have overlooked here or
if this can NOT be done under current implementation of JavaScript ?

What I want to do is:
automatically track the number of URLs included in each new page,
while surfing through the WWW.

Attached at the end is one of possible solutions I have figured out so far.
It includes two files ---
index.html, which constructs 3 frames.
            frames[0] for net surfing,
            frames[2] for the record of periodical tracking.
ctrl.html,  tracking function loaded into frames[1].

It looks okay for the 1st (if http:// scheme used)
or first two (if file:/ used ) web pages visited.
However, the Netscape 2.0 will CLOSE itself COMPLETELY
if you go further and try to visit a new URL via hyperlink in frame[0]. 

I have also tested another possible way of using window.open()
instead of frame. It had similar problem.

My wild guess is that, somehow, I need to clean stacks when moving
from one page to another, but not able to dig out a method to do it.

Or is there an alternative ?

thanks,

Zhangfan


-----------------------index.html------------------------------

<HTML>

<HEAD>
 
<TITLE>JavaScript Abuse</TITLE>
 
</HEAD>

<FRAMESET ROWS="70%,30%">
		<FRAME SRC="http://home.netscape.com"; NAME="">
	<FRAMESET COLS="70%,30%">
		<FRAME SRC="ctrl.html" NAME="">
		<FRAME SRC="" NAME="">
	</FRAMESET>
</FRAMESET> 

</HTML>

------------------------ctrl.html------------------------------

<HTML>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--

var num;
var tid;

function cycle() {
	num = parent.frames[0].document.links.length;
	parent.frames[2].document.open();
	parent.frames[2].document.write(num);
	parent.frames[2].document.close();
	tid = setTimeout("cycle()", 1000);
}

//-->
</SCRIPT>

</HEAD>

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!--

cycle();

//-->
</SCRIPT>

</BODY>

</HTML>

--------------------------------end---------------------------------