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
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.