Click here to Skip to main content
15,886,712 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am opening .pdf document inside a IE browser window.

When i tried to close the browser using popup.close on logout

button .It is giving me permission denied error.

It works just fine when I change the link to Google, but when I

make the change back to the pdf document it just giving me
error in IE.
JavaScript
function js_ClosePopUps() {
    if (popups.length == 0) return;
    try
    {
        for (i = 0; i < popups.length; i++) {
            popups[i].close();
        }
    }
    catch(ex)
    {
        alert(popups.name);
        alert('An error has occurred: '+ex.message)
    }
}

This is the code which i am using for closing the popup window in IE.

Please resolve this problem.
Posted
Updated 7-Jun-13 2:48am
v2
Comments
Prasad Khandekar 7-Jun-13 8:49am    
Can you provide more details on popups. is this an array which you are populating using value returned by window.open?
Member 8533630 7-Jun-13 9:03am    
yes popups is using as an array.
var popups = new Array();
Apart from this,I am using following code for opening the pop up window

function PopupCenter(pageURL, title,w,h){ var left = (screen.width/2)-(w/2);

var top = (screen.height/2)-(h/2);

var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);

popups.push(targetWin);}

Here I am using popups.push for reference of open window. which get reference of all open window.
Now in js_closePopups method - popups array will calculate the number of opening windows. and will close all the windows one by one using popups[i].close();


But the browser in which pdf report is opening not consider it as a IE browser and giving permission denied error.

1 solution

First of all, you should not assume that the browser is IE, and you should not assume that the client's browser supports PDF. Despite of the wide use of PDF files on the Web, this is not a part of any W3 standards and not supported on all browsers and all platforms. (I, for example, exterminated anything related to Adobe Acrobat from all my Windows systems, don't have PDF support in any of the browsers I use, and now feel much better.)

Check up you file system permission on the object in question, but also remember that HTTP server executes Web application in sandboxed environment allowing the access only to those server-side host's file system objects under the root directory of your site.

—SA
 
Share this answer
 
Comments
Member 8533630 10-Jun-13 1:00am    
Still my problem is not solved by this content.Please give me relevant input to solve this issue.Is there any alternate of this problem.
Kindly solve my problem.
Sergey Alexandrovich Kryukov 10-Jun-13 9:18am    
If the problem is addressed incorrectly, it cannot be solved. Your real solution should be recognition of this incorrectness. Do you see the point?
—SA
Member 8533630 11-Jun-13 1:39am    
Yes I have seen this point. I am new in the development. please elaborate this point so that i can use it in my application.
Sergey Alexandrovich Kryukov 11-Jun-13 6:54am    
Which point? What's unclear or what help do you need?
—SA
Member 8533630 11-Jun-13 7:42am    
Which file system permission i have to check in the application.
Main thing i have to close the pop up browser in which pdf file is opening(this is the requirement to close all application popup after logout from an application)
Can u plz tell me is any other way to open a pdf file .so that if i logout from the application,then pop up should always be closed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900