Topic: Modal Popup, needs to close and return user to link/hash Pages that link to <a href="https://ozoneasylum.com/backlink?for=28068" title="Pages that link to Topic: Modal Popup, needs to close and return user to link/hash" rel="nofollow" >Topic: Modal Popup, needs to close and return user to link/hash\

 
Author Thread
AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

IP logged posted posted 06-13-2006 01:17 Edit Quote

Hello all, it's a wonder I haven't killed myself today )

I have a page with an exit popup, it's using (for IE only) a showModalDialog.

I need it to do the following
The popup comes up on page exit (Working)
The Popup has a link and a button, both going to the same place.
Clicking them closes the Popup and accesses a hash (#here)

So, after the popup someone can click the link, it loads the page in the parent and scrolls down to the anchor...

The problem is, after the link is clicked it would close the popup and scroll to the anchor BUT then the page would refresh.

Right now I have an alert box jumping up showing the hash. Without that ir doesn't pause enough to show that it's actually scrolling down to the proper anchor... After you click OK, it just refreshes the dang page... it sucks

Check it out, I left out the link code so it wont get hit from bots etc.
ultrametabolismbook.com/ap0-explain.html

I'm no JS guy, never claimed to be I swear...

Thanks

Casey / AT
Personal
Song Lyrics
Family Recipes

Blaise
Paranoid (IV) Inmate

From: London
Insane since: Jun 2003

IP logged posted posted 06-13-2006 11:36 Edit Quote

How have you linked to your anchor point?

usually if you used a regular link within a page to access an anchor it would look something like this...

code:
<a href="#content">

but if you put something in like this...

code:
<a href="myPage.html#content">

Then it may well reload the page. That's all I can think of for now.

Cheers,

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-14-2006 18:32 Edit Quote

what happens if you don't assign the location?
Ie. does it refresh just because the showModal() Dialog exited?

How are you redirecting in the first place?

Show us some code

AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

IP logged posted posted 06-14-2006 18:54 Edit Quote

yes yes, duh... Code... *shakes head*

This is the page that on exit the popup is called. It's set via an onunloan event.

code:
var exit=true;
	var url="http://www.ultrametabolismbook.com/explain-exit.html";
	// FF
	var ffh=585;
	var ffw=660;
	// IE
	var wh=650;
	var ww=678;	

	function modalWin() {
		if (exit) {
			if (window.showModalDialog) {
				LeftPosition = (screen.width) ? (screen.width-ww)/2 : 0;
				TopPosition = (screen.height) ? (screen.height-wh)/2 : 0;
				sF = "dialogWidth:"+ww+"px;dialogHeight:"+wh+"px;dialogTop:"+TopPosition+";dialogLeft:"+LeftPosition;
				detWin = window.showModalDialog(url, window, sF);
				eval(detWin);
			} else {
				LeftPosition = (screen.width) ? (screen.width-ffw)/2 : 0;
				TopPosition = (screen.height) ? (screen.height-ffh)/2 : 0;
				window.open(url,'exitpopup', 'height='+ffh+',width='+ffw+',top='+TopPosition+',left='+LeftPosition+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes');
			}
		}
	}



The popup contains this JS...

code:
function load(url) {
		if (window.dialogArguments && dialogArguments.location) {
		dialogArguments.location.hash=url; // url being the hash (#offer)
		window.close();
		} else {
			window.opener.location.href=url;
			timer = setTimeout('window.close();', 10);
		}
	}



When the link in the body is clicked, it's using an onClick event to pass in the hash it's to jump to. It does, but then the page refreshes back to the top.

Thanks

Casey / AT
Personal
Song Lyrics
Family Recipes

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-14-2006 19:07 Edit Quote

huh?
Am I reading this right: you're setting the parent's window's location within the dialog?
Well, don't do that .

Try setting the location after the dialog has returend - you should be able to return a result form the dialog.

AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

IP logged posted posted 06-15-2006 18:12 Edit Quote

I tried that, still jumps down to the hash and then back to the top. It's crazy.

Have you tried it? Thanks TP

Casey / AT
Personal
Song Lyrics
Family Recipes

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-16-2006 10:03 Edit Quote

sorry, I'm not at a machine I can play with right now - what happens if you do a windows.settimeout ( setnewlocation,1) after the dialog returned?

AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

IP logged posted posted 06-16-2006 19:21 Edit Quote

Ok, tried that just now and it still refreshes to the top.

I wonder how we can fix this...

Casey / AT
Personal
Song Lyrics
Family Recipes

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-17-2006 16:18 Edit Quote

tell me - does it refresh if you don't set the location?

AT
Bipolar (III) Inmate

From: Gainesboro, TN, USA
Insane since: Aug 2000

IP logged posted posted 06-20-2006 07:57 Edit Quote

No it doesn't refresh when nothing is set.

Now what?

I've done gone bald from pulling my hair out.

Casey / AT
Personal
Song Lyrics
Family Recipes

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 06-20-2006 10:24 Edit Quote

Ok... does it refresh when you set outside the dialog return?

I wish to eliminate the dialog return as the source of your problem...



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu