Jump to content

is it possible to execute a href without have to click on it


cicahusi

Recommended Posts

[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.
Link to comment
Share on other sites

[quote author=cicahusi link=topic=123240.msg509099#msg509099 date=1169289209]
it is detailed here
http://www.phpfreaks.com/forums/index.php/topic,123200.0.html

it 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.php
and on login_succes.php you do the redirect to the page wich also reloads the menu
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[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]
Link to comment
Share on other sites

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