Solved

redirect after popup

Posted on 2010-08-20
8
485 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
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…

776 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