Solved

redirect after popup

Posted on 2010-08-20
8
492 Views
Last Modified: 2012-05-10
hello
what i am trying to is when a user logs out, popup a box saying you have logged out etc then load a redirect to the login page. can someone look at my code and tell me why it just redirects and the popup never happens? if i reove the redirect popup works fine. many thanks
<script type="text/javascript">
			//<![CDATA[
				$.setupJMPopups({
					screenLockerBackground: "#003366",
					screenLockerOpacity: "0.7"
				});

				function openStaticPopup() {
					$.openPopupLayer({
					name: "mySecondPopup",
					width: 550,
					target: "myHiddenDiv"
				});

				}
			//]]>
		</script>
		<script type="text/javascript">
				<!--
				window.location = "/sample/index.php"
				//-->
		</script>
		<div id="myHiddenDiv">
			<div class="popup">
				<div class="popup-header">
					<h2>Logistor Logout</h2>
					<a href="javascript:;" onclick="$.closePopupLayer('mySecondPopup')" title="Close" class="close-link">Close</a>
					<br clear="all" /><br /><br />
				</div>
				<div class="popup-body">
					<code>
						<pre>
								This is just a test
						</pre>
					</code>
			</div>
		</div>
		</div>

Open in new window

0
Comment
Question by:peter_coop
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:mahadazad
ID: 33488026
The reason is very clear; when the page loads it is redirected instantly... You could do one thing, on the page load show the popup... and on the popup close event redirect the page.
0
 

Author Comment

by:peter_coop
ID: 33488480
hi. wanted to redirect while the popup was still active and let them close it. thanks
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 33489180
what about a simple solution like this

<script>
alert("Goodbye, come back!");
window.location = "http://google.ca";
</script>
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:peter_coop
ID: 33489205
problem with that solution hainkurt is that it also closes the popup which i want to keep on top and let the client close the popup. i am using the code below which is called from this:

onload="openStaticPopup()"

many thanks
function openStaticPopup() {
	$.openPopupLayer({
	name: "mySecondPopup",
	width: 550,
	target: "myHiddenDiv",
	success: function() {
								window.location = '/sample/index.php';
								}
				});

Open in new window

0
 
LVL 51

Accepted Solution

by:
HainKurt earned 250 total points
ID: 33489260
ok do this...
on your popup

window.opener.window.location = '/sample/index.php';

and use this to open popup
function openStaticPopup() {
	$.openPopupLayer({
	name: "mySecondPopup",
	width: 550,
	target: "myHiddenDiv",
});

Open in new window

0
 

Author Comment

by:peter_coop
ID: 33489339
i am already doing that from the onload event. have i misunderstood u? thanks
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 33490320
you run redirect from popup page in my suggested solution above
0
 

Author Closing Comment

by:peter_coop
ID: 33490863
thank you
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question