I am building a website that's worked out very nicely so far with few problems. It's mainly coded in php and xhtml with css. This site also uses 1 inline frame.

I don't know much about javascript - it seems to be such an immense scripting language to me, but what I do know is that it's useful for things like what I'm trying to do - specifically refreshing/reloading pages.

I found a snippet of javascript that works very well provided that it's only one child and one parent, but now I'm running into a problem.

On the main site (parent page) there is a link to register. This results in a pop up window - done by javascript. This popup window contains the terms of registering to the site, and if the user agrees to the terms he/she clicks a button which will take the user to a registration form in the same popup, via a form submit button.

After he/she registers and clicks on the submit button for the registration page, the popup window will then load a third page which processes user data, does checks against the database, etc etc, and if successful the user will then have a limited account for the site.

My problem is trying to refresh the original parent (main site) page that executed the original popup, so that the links will update.

When a user logs into the site, he/she is prompted to enter their information into an inline frame in the parent site, and the javascript snippet that I have will refresh the parent page just fine.

When I use this same snippet or any of the other thousands of snippets out there on the web, it seems to refresh either the first popup window that contains the terms, or it will refresh the popup window that contains the registration process, which will result in an error saying the user is already logged in.

What I would like to do is have the user click a continue button after reading the "Welcome to the site blah blah blah" /process registration page after user registration is successful and completed, which will close the popup window and refresh the original parent window.

Does anyone know what I should look into for this, or can point me in the right direction?

Site map is like:
parent page
|
V
popup1(terms) > popup1(register form) > popup1 (process data/welcome message)

popup1(process data...etc) should refresh the parent page

the snippet I'm using is:

<script>
function checkit()
{
	myvar = location.search.substr(1);
	if (myvar=="b"){ }
	else{ setTimeout("window.parent.location.href = window.parent.location.href+'?b'",3000);}
}

window.onload=checkit;

</script>

I fixed this problem.

I relocated the javascript - instead of putting it on a bodyLoad command I attached the function to the link itself.

I forgot I had the script embedded in the page of the iframe, and it was actually being refreshed but each time it did it was popping up the popup again because the script was embedded in the page instead of attached to a link.

for whatever reason the links would never update, but I think it was because it was actually refreshing the page that was being called into the iframe, and not the actual site itself that had the iframe embedded in it.

I hope this makes sense - if not sorry its 4am lol

anyways, yea - this thread has been solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.