HighDots Forums  

Shutting down _blank windows

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Shutting down _blank windows in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Skaterstu
 
Posts: n/a

Default Shutting down _blank windows - 11-12-2005 , 10:23 PM






Hi All,

I have designed some pages for my freelance writer / photographer friend,
whereby I click on a menu item and clips of her articles appear in a new window
(using target "_blank"). What I want to be able to achieve is that when
someone has read the article, then they can click a hyperlink or button, which
will close the window down. I know that it can be easily achieved by just
clicking on the x botton in the top right hand corner of the window, but I'd
like to know if I can do this and encorporate it into the website.

Thanks

Stuart

Cheers

Stuart


Reply With Quote
  #2  
Old   
-D-
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-12-2005 , 10:34 PM






You can do this very easily with javascript:

create a function:

function CloseWindow() {
window.close();
}

In your button or link add the onclick event handler and call the
CloseWindow function

onClick="CloseWindow();"

That should do the trick.

Hope this helps.
-D-


"Skaterstu" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi All,

I have designed some pages for my freelance writer / photographer friend,
whereby I click on a menu item and clips of her articles appear in a new
window
(using target "_blank"). What I want to be able to achieve is that when
someone has read the article, then they can click a hyperlink or button,
which
will close the window down. I know that it can be easily achieved by just
clicking on the x botton in the top right hand corner of the window, but
I'd
like to know if I can do this and encorporate it into the website.

Thanks

Stuart

Cheers

Stuart





Reply With Quote
  #3  
Old   
Skaterstu
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 12:02 AM



Thanks -D-,

Sorry, I am have no experience with Javascript. Do I add the function in my CSS external file?

Reply With Quote
  #4  
Old   
-D-
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 01:36 AM



Glad to help.

Add the function between the <head> tag in your html page.

<head>
<script language="javascript">
<!--
function CloseWindow() {
window.close();
}
//-->
</script>
</head>

-D-



"Skaterstu" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Thanks -D-,

Sorry, I am have no experience with Javascript. Do I add the function in
my CSS external file?





Reply With Quote
  #5  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 03:26 AM



..oO(Skaterstu)

Quote:
I have designed some pages for my freelance writer / photographer friend,
whereby I click on a menu item and clips of her articles appear in a new window
(using target "_blank").
Why?

Quote:
What I want to be able to achieve is that when
someone has read the article, then they can click a hyperlink or button, which
will close the window down.
Every browser already has a properly working "close window" button.

Quote:
I know that it can be easily achieved by just
clicking on the x botton in the top right hand corner of the window, but I'd
like to know if I can do this and encorporate it into the website.
GUI controls can never be replaced with something equally reliable.
While you can close a window with JS, it will cause problems or confuse
the visitor now and then. If JS is not available the link won't work at
all ...

Micha


Reply With Quote
  #6  
Old   
Gary White
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 08:48 AM



On Sun, 13 Nov 2005 09:26:40 +0100, Michael Fesser <netizen (AT) gmx (DOT) de>
wrote:

Quote:
GUI controls can never be replaced with something equally reliable.
While you can close a window with JS, it will cause problems or confuse
the visitor now and then. If JS is not available the link won't work at
all ...

<script type="text/javascript">
document.write('<a href="javascript:window.close();">Close</a>');
</script>

Gary


Reply With Quote
  #7  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 08:50 AM



..oO(Gary White)

Quote:
script type="text/javascript"
document.write('<a href="javascript:window.close();">Close</a>');
/script
Better.

But I still consider it rather useless ... at least the above doesn't
cause usability issues.

Micha


Reply With Quote
  #8  
Old   
Gary White
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-13-2005 , 11:51 AM



On Sun, 13 Nov 2005 14:50:11 +0100, Michael Fesser <netizen (AT) gmx (DOT) de>
wrote:

Quote:
Better.

But I still consider it rather useless ... at least the above doesn't
cause usability issues.

Exactly.

Gary


Reply With Quote
  #9  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-14-2005 , 08:08 AM



How about this -

<noscript>
<script type="text/javascript">document.write("You need to enable js to see
this stuff")</script>
</noscript>

8)

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Gary White" <reply (AT) newsgroup (DOT) please> wrote

Quote:
On Sun, 13 Nov 2005 14:50:11 +0100, Michael Fesser <netizen (AT) gmx (DOT) de
wrote:

Better.

But I still consider it rather useless ... at least the above doesn't
cause usability issues.


Exactly.

Gary



Reply With Quote
  #10  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Shutting down _blank windows - 11-14-2005 , 09:18 AM



..oO(Murray *TMM*)

Quote:
How about this -

noscript
script type="text/javascript">document.write("You need to enable js to see
this stuff")</script
/noscript
Too late, I've already seen something similar on a real website!

Micha


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.