/    Sign up×
Community /Pin to ProfileBookmark

php question? popup on close run scritp.php

I have a javascript popup window with 2 hyperlinks in it. First link downloads a file, second link closes the window and returns to my site.

The question is, when the popup window gets closed, can I run a php script after that?

So something like:

[CODE]
<SCRIPT LANGUAGE=”JavaScript”>

function popitup2() {
newwindow2=window.open(”,’name’,’height=300,width=300,top=200,left=300′);
var tmp = newwindow2.document;
tmp.write(‘<html><head><title>My Site</title>’);
tmp.write(‘<link rel=”stylesheet” href=”js.css”>’);
tmp.write(‘</head><body><p>.</p>’);
tmp.write(‘<p><a href=”path/to/url”>view location</a>.</p>’);
tmp.write(‘<p><a href=”javascript:self.close()”>close</a> the popup.</p>’);
tmp.write(‘</body></html>’);
tmp.close();
}
</script>

</HEAD>
<BODY onLoad=”javascript:popitup2(”)”>

[/CODE]

So I have it load up when the page gets loaded, but it there a way to run a script when I close this popup?

something like this:

[CODE]
<SCRIPT LANGUAGE=”JavaScript”>

function popitup2() {
newwindow2=window.open(”,’name’,’height=300,width=300,top=200,left=300′);
var tmp = newwindow2.document;
tmp.write(‘<html><head><title>My Site</title>’);
tmp.write(‘<link rel=”stylesheet” href=”js.css”>’);
tmp.write(‘</head><body><p>.</p>’);
tmp.write(‘<p><a href=”path/to/url”>view location</a>.</p>’);
tmp.write(‘<p><a href=”javascript:self.close([COLOR=Red]RUN PHP SCRIPT HERE[/COLOR])”>close</a> the popup.</p>’);
tmp.write(‘</body></html>’);
tmp.close([COLOR=Red] OR RUN PHP SCRIPT HERE[/COLOR]);
}
</script>

</HEAD>
<BODY onLoad=”javascript:popitup2(”)”>

[/CODE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@bokehAug 31.2006 — You should have posted in the Javascript forum. The answer is neither. You need to add an onunload event.
×

Success!

Help @Phill_Pafford 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...