JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old June 14th, 2004, 05:21 AM
csmith587 csmith587 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 csmith587 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Close window when opening new window

I have a site with several pictures scattered throughout that pops up another window for a larger view. Three of the pictures are from an art institute. The condition for use is that a link to the institute must be accessible from the picture.



The sequence of events:

Small image clicked –large image opens in a new window

Link on large image clicked –institute site loads in a new window



Now the visitor has three windows open, the parent window, large image window and the institute. Too many.



What I’ve been struggling with is trying to close the large image window when loading the institute window.



Strange things have happened. I’ve gone from getting a prompt that the web page is trying to close the window (not very professional) to closing before it even finishes opening.



Any suggestions would be greatly appreciated.



Thanks

Reply With Quote
  #2  
Old June 14th, 2004, 05:31 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
You will only get the warning if you attempt to close a window you did not create - and from you have described, this is not what you want to do anyway - you are trying to close the pop up (large image). In the large image window, create a JS function which first, generates a new window for the institute link, then closes itself... e.g.
Code:
<script type="text/javascript">
function viewInstitute(url) {
  x = window.open(url,"popInstitute",your window features)
  this.close()
}
</script>

<!-- the HTML -->
<a href="#" onclick="viewInstitute('http://wwww.blah.com')"><img src="images/blg.jpg" alt="" /></a>
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old June 14th, 2004, 06:10 AM
csmith587 csmith587 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 csmith587 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for responding, you were a tremendous help. It wasn’t until reading your message that I realized my problem.



I was testing the window.close() from the large image window. Obviously it would prompt that the web page is trying to close the window because it was the parent.



Don’t know where my mind was but appreciate you giving me a jump start.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Close window when opening new window


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway