cicahusi Posted January 20, 2007 Share Posted January 20, 2007 i have to execute <a href="menu.php" target="menu">reload the menu</a>or something (php/javascript) with the same effect, without user have to do anything.It is for refresh the menu in a different iframe (menu), after a successful login/logout. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 20, 2007 Share Posted January 20, 2007 :S your question is confusing .. when the page loads or after something? what are you saying just execute the href with out any condision? is it possible for a user to stay still for more than 3 seconds.. Quote Link to comment Share on other sites More sharing options...
hackerkts Posted January 20, 2007 Share Posted January 20, 2007 Try meta refresh. Quote Link to comment Share on other sites More sharing options...
cicahusi Posted January 20, 2007 Author Share Posted January 20, 2007 it is detailed herehttp://www.phpfreaks.com/forums/index.php/topic,123200.0.htmlit works with meta, but it seems so lame to refresh it every 2 sec when i only need it once after the login/logout Quote Link to comment Share on other sites More sharing options...
cicahusi Posted January 20, 2007 Author Share Posted January 20, 2007 [quote author=corillo181 link=topic=123240.msg509096#msg509096 date=1169288850]:S your question is confusing .. when the page loads or after something? what are you saying just execute the href with out any condision? is it possible for a user to stay still for more than 3 seconds..[/quote]1, the menu loads when the iframes created.2, i dont need the href, i only need a command/script, which does the same effect. I dont want anything to appear on the page, only want to load the menu.php again in the menu iframe. Quote Link to comment Share on other sites More sharing options...
cicahusi Posted January 20, 2007 Author Share Posted January 20, 2007 But as i wrote in the other topic too, u can see my problem http://villornet.freeweb.hu/ herename: xypwd: xyafter u log in/out , u have to manually refresh the menu with that href, which refresh the menu.php in the menu frame Quote Link to comment Share on other sites More sharing options...
anatak Posted January 21, 2007 Share Posted January 21, 2007 [quote author=cicahusi link=topic=123240.msg509099#msg509099 date=1169289209]it is detailed herehttp://www.phpfreaks.com/forums/index.php/topic,123200.0.htmlit works with meta, but it seems so lame to refresh it every 2 sec when i only need it once after the login/logout[/quote]a work around is making a login / logout page.for example after user is successfully logged it you redirect him to login_succes.phpand on login_succes.php you do the redirect to the page wich also reloads the menu Quote Link to comment Share on other sites More sharing options...
mainewoods Posted January 21, 2007 Share Posted January 21, 2007 you can change the url of the page currently in your iframe by using this javascript syntax:[code]document.getElementById('iframe_id_name').src = "your new url";[/code]I've done that before and it works and is cross browser compatable, but the fly in the ointment is that it messes up the browser history and basically disables the browser backarrow and the user can get really confusing results if they use the backarrow. What can happen is that the page that was just in the iframe will load in the whole window if the backarrow is used. Because of those reasons, I would advise against loading of any new pages in an existing iframe and only 'roll into' a new page containing an iframe in it. Quote Link to comment Share on other sites More sharing options...
cicahusi Posted January 22, 2007 Author Share Posted January 22, 2007 [quote author=mainewoods link=topic=123240.msg510095#msg510095 date=1169423419]you can change the url of the page currently in your iframe by using this javascript syntax:[code]document.getElementById('iframe_id_name').src = "your new url";[/code]I've done that before and it works and is cross browser compatable, but the fly in the ointment is that it messes up the browser history and basically disables the browser backarrow and the user can get really confusing results if they use the backarrow. What can happen is that the page that was just in the iframe will load in the whole window if the backarrow is used. Because of those reasons, I would advise against loading of any new pages in an existing iframe and only 'roll into' a new page containing an iframe in it.[/quote]I tryed this one, but it only works, if the iframe is created in the same file, and in my case the iframes are created in the index.html, and i would target one of them from the login.php, which is loaded in the other frame.[code]//login.php...<h2> <?=$uid?> logged in. </h2><script type="text/javascript">document.write(document.getElementsByTagName("iframe")[0].id); //even this does not work, so it doesnt find any iframe document.getElementById('menu').src = "menu.php";//doesnt work</script><a href="menu.php" target="menu">reload the menu</a><br><br> //this works! so somehow this can target the iframe, created in the index.html. //But this is not automatic... u have to click on it[/code] Quote Link to comment Share on other sites More sharing options...
cicahusi Posted January 22, 2007 Author Share Posted January 22, 2007 [code]<script type="text/javascript">if (window.top!=window.self) { window.top.location="index.html" }</script>[/code]This seems to be working. It dont have the same effect at all than the original goal, but it breaks out of the frames and reload the whole page, which includes the menu frame.I am still interested if u can find a way to target iframes created in other files, with javascript.Thx for the helps so far. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 22, 2007 Share Posted January 22, 2007 In other files? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.