PDA

View Full Version : Refresh one page from another.



raavi
02-19-2009, 09:47 AM
Hi Friends,
I am working on a application which uses two Html windows which are indepedent of each other.

my requirement is, if I click on link in Page1,if the Page2 is opened then Page2should refresh.(refresh page2 from page1)

Friends,I need to know whether its possible? and any Javascript methods are helpful in solving this.


thanks,
Raavi

Master_script_maker
02-19-2009, 08:54 PM
it is possible if you open page2 from page1 with javascript. then you would use: myWindow=window.open('http://www.mysite.com'); and when you click a link: myWindow.window.location.href="http://www.mysite.com"; //refresh

raavi
02-24-2009, 04:14 AM
thank you for reply.

But in this case, the windows are not parent and child.
they are different and they are opened independently.
is refresh is possible in this case?


thanks in advance.

Falkon303
02-24-2009, 05:11 AM
I think it's possible if you use ajax to dynamically inject into the second page. It may be a bit risky. If you are familiar with dynamic post requests, try this out.

What you'd have to do is have this kind of php in the header of the page recieiving the request.

for example

<? if ($_POST['link'] == "refresh") {echo "<meta http-equiv=\"refresh\" content=\"0;url=index.php\">";} else {;} ?>

using ajax, I think if this was in the header of a normal page, it should refresh it.

I can make you a mock up and zip send it to you if you have no idea what I am talking about. I am most sure it would be the best way to accomplish this. Be sure that you block external addresses though (in your php).

raavi
02-25-2009, 08:04 AM
Thank you..

I am not much aware of Ajax and Php.
Can U please send me the zip file.

Falkon303
02-25-2009, 11:41 PM
Thank you..

I am not much aware of Ajax and Php.
Can U please send me the zip file.


sure thing, but you are the one in charge of the security of it. All I offer you is a bare bones script, and also, after I am off work.

- Ben

Falkon303
02-26-2009, 05:02 AM
Hah! I ate my words raavi!

It is more difficult than I had thought using ajax to accomplish this, but here is some source code that should do the trick.

http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.javascript/2005-10/msg00960.html

raavi
02-26-2009, 06:51 AM
:)

no issues....