Title: [Plugin: Shadowbox JS] Closing a Shadowbox
Last modified: August 20, 2016

---

# [Plugin: Shadowbox JS] Closing a Shadowbox

 *  [ipcst](https://wordpress.org/support/users/ipcst/)
 * (@ipcst)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-shadowbox-js-closing-a-shadowbox/)
 * I’m using Shadowbox overlay to diplay a .htm page. From some locations the page
   is opened in a new tab, but it can also be opened in a Shadowbox from elsewhere.
   I want to include a ‘Close Window’ text link, but this needs to be different 
   for the tab version and the Shadowbox version, so I’ve included the following
   Javascript:
 *     ```
       <script type="text/javascript">
       if (self==top)
       {document.write("<a href='self.close();'>Close Window</a>");}
       else
       {document.write("<a href='Shadowbox.close();'>Close Window</a>");}
       </script>
       ```
   
 * The tab version closes as expected, but the Shadowbox version doesn’t. The page
   itself closes, but it leaves the overlay in place – just a black box. I can only
   close the overlay by clicking outside the Shadowbox or clicking the ‘X’ button.
   Since the overlay is large, it isn’t obvious to the user to do this.
 * I’m not greatly experienced so if this is something blindingly obvious please
   excuse my ignorance.
 * [http://ipcst.org/blog/?page_id=45](http://ipcst.org/blog/?page_id=45) click 
   the first thumbnail for the Shadowbox version.
    [http://www.ipcst.org/projects.htm](http://www.ipcst.org/projects.htm)
   click ‘Taquara’ on the left for the tab version.
 * I tried using Thickbox Plus before I installed Shadowbox, but I had the same 
   problem. Any help would be deeply appreciated – this is for our charity website,
   and I’ve wasted far too many hours on it.
 * Patrick Cunningham
 * EDIT:
    I just realised there was some text black-on-black (so invisible) in the
   window after the page closed: “Not Found
 * The requested URL /shadowbox.close(); was not found on this server.
 * Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument
   to handle the request.”
 * [http://wordpress.org/extend/plugins/shadowbox-js/](http://wordpress.org/extend/plugins/shadowbox-js/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [ipcst](https://wordpress.org/support/users/ipcst/)
 * (@ipcst)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-shadowbox-js-closing-a-shadowbox/#post-2741998)
 * I finally found a solution to this, so in case anyone has the same issue here
   it is. It’s so simple it seems stupid:
    in place of
 *     ```
       else
       {document.write("<a href='Shadowbox.close();'>Close Window</a>");}
       ```
   
 *     ```
       else
       {document.write("<a href='http://www.mysite.com/pageiwason.htm' target='_top'>Close Window</a>");}
       ```
   
 * where [http://www.mysite.com/pageiwason.htm](http://www.mysite.com/pageiwason.htm)
   is the url of the parent page the Shadowbox opened from.
 * Patrick Cunningham

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Shadowbox JS] Closing a Shadowbox’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shadowbox-js.svg)
 * [Shadowbox JS](https://wordpress.org/plugins/shadowbox-js/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shadowbox-js/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shadowbox-js/)
 * [Active Topics](https://wordpress.org/support/plugin/shadowbox-js/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shadowbox-js/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shadowbox-js/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [ipcst](https://wordpress.org/support/users/ipcst/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-shadowbox-js-closing-a-shadowbox/#post-2741998)
 * Status: not resolved