From: DL on
Hi,

I have a main page and a secondary page, what I'd like to do is like
this:
when the second page is opened and if the user take an action, that
is, click on a link on the second page, then, when the second page is
closed I want the main page to be refreshed
(so, for the second page, body onunload="opener.reload()")
but again, do so if only the user click on a link of the second page,
is there something like if conditionX is true
document.body.onunload=false?

Let me if the above problem statement is clear.

Thanks.

From: DL on
On May 31, 8:48 pm, DL <tatata9...(a)gmail.com> wrote:
> Hi,
>
> I have a main page and a secondary page, what I'd like to do is like
> this:
> when the second page is opened and if the user take an action, that
> is, click on a link on the second page, then, when the second page is
> closed I want the main page to be refreshed
> (so, for the second page, body onunload="opener.reload()")
> but again, do so if only the user click on a link of the second page,
> is there something like if conditionX is true
> document.body.onunload=false?
>
> Let me if the above problem statement is clear.
>
> Thanks.

Posted it too fast, so, there are some grammar errors etc. Here's
another way to describe it.

Page A -> Page B (pB)

Two possibilities for pB:
a) Click on a link
b) Do not click on anything and close pB

Desired outcome for pB
For the above a):
Make the body onunload="opener.reload()" valid for pB
For the above b):
Make the body onunload="opener.reload()" invalid for pB

How could we achieve it?

Thanks in advance.


From: SAM on
Le 6/1/10 6:32 AM, DL a �crit :
>
> Page A -> Page B (pB)
>
> Two possibilities for pB:
> a) Click on a link
> b) Do not click on anything and close pB
>
> Desired outcome for pB
> For the above a):
> Make the body onunload="opener.reload()" valid for pB
> For the above b):
> Make the body onunload="opener.reload()" invalid for pB

from B,
open mother (A)
opener.reload();
open grand mother (mother of A) and probably if A wasn't closed
opener.opener.reload()

but ... any way, to play with popups is bad ...
--
sm
From: DL on
On Jun 1, 4:35 am, SAM <stephanemoriaux.NoAd...(a)wanadoo.fr.invalid>
wrote:
> Le 6/1/10 6:32 AM, DL a écrit :
>
>
>
> >PageA ->PageB (pB)
>
> > Two possibilities for pB:
> > a) Click on a link
> > b) Do not click on anything and close pB
>
> > Desired outcome for pB
> > For the above a):
> > Make the body onunload="opener.reload()" valid for pB
> > For the above b):
> > Make the body onunload="opener.reload()" invalid for pB
>
> from B,
> open mother (A)
>       opener.reload();
> open grand mother (mother of A) and probably if A wasn't closed
>       opener.opener.reload()
>
> but ... any way, to play with popups is bad ...
> --
> sm

Sorry, Sam, I don't get it. But there's a good reason for doing what
I'm doing.
From: SAM on
Le 6/2/10 5:57 AM, DL a �crit :
> On Jun 1, 4:35 am, SAM <stephanemoriaux.NoAd...(a)wanadoo.fr.invalid>
> wrote:
>>
>> but ... any way, to play with popups is bad ...
>
> Sorry, Sam, I don't get it. But there's a good reason for doing what
> I'm doing.

Sorry, but my answer certainly didn't give the solution.



Supposing links in B open called file in B.
Then,
- will B remember the "onunload" ? ?
- will B remenber its opener ?

Test and try something like that in files in B :

var pB = false;

function reloadMain() {
if(!opener) alert('mother is lost !');
else if(pB) opener.reload();
}
function yesNo() {
pB = true;
setTimeout(function(){pB=false;},100);
}
function init() {
var a = document.links, n = a.length;
while(n--) a[n].onclick = yesNo;
}

<body onload="init()" onunload="reloadMain()"

--
sm