Howto: Open a Javascript popup from an external file

L

lihao

Hi, guys:

I am not sure if this is doable. In page-1, there is a Javascript
onclick event that invoke an pop-up window(this window opens only when
clicking a button). and now I want to setup a link from page-2 to open
page-1 and directly pop up this window. how can I setup this? I know
there is href="javascript:<some code>" which works on the same
document? Can I do this to an external files.

Many thanks,
lihao
 
S

Scott Sauyet

I am not sure if this is doable. In page-1, there is a Javascript
onclick event that invoke an pop-up window(this window opens only when
clicking a button). and now I want to setup a link from page-2 to open
page-1 and directly pop up this window. how can I setup this? I know
there is href="javascript:<some code>" which works on the same
document? Can I do this to an external files.

Many browsers will not allow you to pop up a window except in response
to some user action, or have a configuration preference to control
this behavior.

You could pretty easily *try* this, by putting some string, say
"autopop" in the query string for the page, and then on document load
run

if (/autopop/.test(document.location.search)) {
// call your pop-up function here.
}

But it will often fail to load the popup. I think a lot of people
would automatically have such a pop-up blocked. I know I do.

Cheers,

-- Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top