Solved

redirect after popup

Posted on 2010-08-20
8
468 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
 

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now