PopUp Window Question

They have: 3 posts

Joined: Apr 2004

Hello,

I am working on a site in which I am utilizing popup windows for specific explanations of products, services and terms. Some of these popups are required to be full-screen, but do not need any extras such as the address bar, buttons, status bar, etc. The javascript I am using can be found below:

<a href="javascript:window.open('Traffic_Blazer/SiteAnalysis.htm', '', 'location=no, menubar=no, status=yes, resizable=yes, scrollbars=yes, toolbar=no');">Click Here</a>'

This code works great for opening the window without the undesired features, however, upon closing the popup and returning to the original window, the user is met with an original window which has been cleared with the exception of the following text:

"[object Window]" or simply "[object]" depending on the browser and platform. The orginal content will return upon pressing "refresh" however, I would rather not leave it up to the client to have to figure that one out.

What am I doing wrong here?

Thank you for your time and energy!

Brooke's picture

She has: 681 posts

Joined: Feb 1999

I might be wrong - but don't you have to have a link to the original page and then the open window link?

Click Here

Try that...

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

I would recommend Brooke's method of using the onClick, however, for the href you can simply link to #.

Also, in the onclick, you do NOT need the javascript: at the beginning. I would also add after the semicolon return false;. If I remember right, reutning a false value should cause the browser to not even execute the HREF part. I could be wrong, it was a few years ago I learned all of that Wink

-Greg

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Oh please, please don't link to the #...

http://www.zerocattle.com/articles.php?id=1

Use the right hyperlink in the href and in the function use that hyperlink:

<a href="original_page" onClick="window.open(this.href,'alwaysNameTheWindow','status=yes,resizable=yes,scrollbars=yes');return false;">Click Here</a>
'

See the link for all the parts you have access to. You don't need to specify "no" to anything, it's all "no" by default.

They have: 3 posts

Joined: Apr 2004

Thank you all for your help. I very much appreciate it. Out of curiousity, why not use the # in the href?

Thanks again!

Nate

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you use # in the href, you break usability and accessibility, and for no reason. It is a few extra characters to put the url in the href and this.href in the function instead of # in the href and the url in the function. For that tiny bit of extra effort, you ensure that your content is NEVER unavailable, on any browser, for any user.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.