[Reply To] RE: [thelist] dreamweaver pop up window code

Jeff Howden jeff at jeffhowden.com
Sat May 3 09:09:39 2003


seamus,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Boldacious Web
>
> Is there a way to hide a javascript close window link
> from non-js  browsers.  Or actually more exactly - I
> want to have a close window link in the pop-up window
> but a back button in the normal page that will open up
> on non-js browsers.
>
> Is this possible?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

well, it depends on whether or not you can trim your posts to thelist.

;p

j/k

seriously though, your request isn't too difficult to accomplish, depending
on a couple of things.

first, if you have server-side scripting available to you then you can solve
the problem of a "back" link for your non-script enabled users.  if not,
you're stuck and they'll have to figure out how to use the back button in
their browser.  whether or not you have server-side scripting available will
also determine how you setup the close window link.

assuming you do have server-side scripting available, just give the link an
onclick event handler with some script to close the window and then return
false.  for the non-script users, you'll need to pass the url they're going
"back" to in the query string.  using server-side scripting, grab that url
from the query string and make it the href of the link.  you're all done.

now, if you're not fortunate enough to have server-side scripting, just use
javascript to write out the link.  make sure to give it the treatment i
mentioned above (onclick event handler, window.close(), and return false
bits).

if you wanted to get particularly tricky, you could make it so that if the
user has scripting, but isn't in the popup, the "back"/close window link
would take them to a page of your choosing on your site.  before trying to
close the window, check to see if the name of the window is what you expect.
if not, they're probably not in a popup, so redirect them to the location of
your choice.  if the window is named what you expect then go ahead and close
the window.

good luck,

.jeff

------------------------------------------------------
Jeff Howden - ColdFusion Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/




More information about the thelist mailing list