/    Sign up×
Community /Pin to ProfileBookmark

Is there a way to make sure a popup window stays behind the parent window until the page in the popup window is fully loaded?

Second, and somewhat related, what is the most reliable way to close a popup? I had tried this:

if(windowname && !windowname.closed) {
windowname.close()
}

However, it did not work on popups created by the following script:

[CODE]function popPDF(pdf) {
var leftPos = screen.width – 720;
var htm = “<html><head><title>Reference</title>”;
htm += “</head><body style=’padding:0;margin:0′>”;
htm += “<iframe src='” + pdf +”‘ width=’100%’ height=’100%’></iframe>”;
htm += “</body></html>”;
var ref = window.open(“”,”ref”,”menubar=1,resizable=1,scrollbars=1,status=1,height=400,width=710,left=”+leftPos+”,top=0″);
ref.document.write(htm);
ref.close;
ref.focus();
}
[/CODE]

So, I tried this one:

window.open(”,’ref’).close();

This worked, but it causes a lot of flicker, which is the reason for question 1.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@NatdripSep 21.2007 — have you tried to focus the main window?

or you could load the content in to a variable using

then after that is complete

load it to a pop up window.

[CODE] var bigbigloadertherebigandstrongandtough = function(){
bob = loaderforinformation()
w = window.open("","knowledgeDialog","width=500,height=350");
d = w.document;
d.open();
d.write(bob);
d.close();

}[/CODE]


loaderforinformation() would be AJAX of COURSE
×

Success!

Help @betheball spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...