Solved

Close a Window -- Permission Denied?

Posted on 2006-11-13
1
1,377 Views
Last Modified: 2012-08-13
My system uses popup windows to show data and stores their window handles in a array (openedWindows).  On timeout, I loop through the array to close all of these windows, but I have trouble closing a window that contains a PDF.

In this section of code:
      for ( var x = 0; x < openedWindows.length; x++ )
            openedWindows[x].close();
I get the error "Permission Denied" when reaching a window containing a PDF.  Other windows (like an About... box) close just fine.

I need to find a way to close all of the popups in the array, including PDFs.

~PerlChaser~
0
Comment
Question by:PerlChaser
1 Comment
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 125 total points
Comment Utility
If the content comes from another domain or even port, then you will not be allowed.

You can put the pdf in a frameset and close the window then:

fset.html:

<frameset rows="100%,*" onLoad="top.contentFrame.location=unescape(location.search.substring(1))">
<frame name="contentFrame" src="blank.html">
</frameset>

link:
w=new Array();
function winOpen(url) {
  w[w.length]=window.open('fset.html?'+escape(url),.....)
}

Michel
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now