Change window location then iframe src when press button

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 15
Joined: Fri Mar 16, 2012 7:38 pm

Fri Apr 06, 2012 1:26 pm

Heya, as the title says I want to refresh the browser and go to "", then change the iframe src to " ... ogout=true"

I currently got this code

Code: Select all

echo "<script type='text/javascript'>";
echo "parent.window.location='http://mydomain/';"; //main window
echo "window.location='';"; //iframe
echo "</script>";
I know parent.window.location work, so does window.location for the iframe, but it only does one of the actions, the first one.

The reason to use both of them is when you login you get extra buttons to the menu, and when you logout i need it to refresh the website to remove the buttons, and still redirect the iframe to the login form with a cute good-bye message.

Any suggestions?

EDIT: I dont want to use any $_GET on the main window( then use javascript to redirect the iframe.

Kind regards,

User avatar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Fri Apr 27, 2012 5:23 pm

i dont understand really where is the iframe and from where you want to redirect, but take a look :

Code: Select all

but, hey, if you first load a page to parent, iframe will disappear ;)

Post Reply