Jump to content

Parent refresh on iframe log-in


Trek15

Recommended Posts

I've got a page with only a CSS menu at the top and an iframe covering the rest of it. The items in the menu of course changes the content in the iframe, but there are also some items in it that are conditional with PHP. When someone logs in to either the blog, forum or gallery within the iframe, some of the items in the menu links to new addresses (before they linked to the forum's registration-page.) The problem is that when someone does this (log in, or log out), the menu items doesn't update with their new content, since it's outside of the iframe.

 

Has anyone got an idea for how i can make it so that the entire page refreshes simultaneously as the function that changes the items in the menu of the parent is called?

 

Here is a sample of the code for one of the items in the menu:

 

<?php
   global $context;
   if ($context['user']['is_guest'])
echo '<li><a href="javascript:loadintoIframe(\'frame\', \'.../forum/index.php?action=register\')">Chat</a></li>;';
else
      echo '<li><a href="javascript:loadintoIframe(\'frame\', \'.../chat.php\')">Chat</a></li>';
?>

Link to comment
https://forums.phpfreaks.com/topic/154524-parent-refresh-on-iframe-log-in/
Share on other sites

inside your iframe code, you can use window.parent to target the parent window (using js).  So if you want to "refresh" the page, you can do for instance window.parent.href='urlhere' or window.parent.reload() etc.. You can target elements etc.. doing window.parent.getElementById('idhere') etc...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.