Hi

Have been battling for hours with a simple function asking a window that was opened with window.open() to be closed. Works fine in Firefox but IE just keeps creating an error "Permission Denied".

I doubted my code as a consequence, but have used sample code to check this and though the sample works over the net on the providers site, locally I still get "Permision Denied". Any ideas would be great.

Sal:rolleyes:

Member Avatar for GreenDay2001

well give the whole code and we'll help u out..

well give the whole code and we'll help u out..

The following is the line of code that prompts the window to open on the click of some text (In this case, either "User's Terms and Conditions" or "Privacy Policy"

<div class="rodsCentred"><div class="rodBackground"><a id="T&C" onclick="F_OpenPDFWindow('../pdfs/legal/UsersTermsAndConditions_V1_Jan2004.pdf')">User's Terms and Conditions</a></div><div class="rodBackground"><a id="PPolicy" onclick="F_OpenPDFWindow('../pdfs/legal/PrivacyPolicy_V1_Jan2004.pdf')">Privacy Policy</a></div>

As I was having trouble in IE with window.focus(), I decided to close the window (opened with window.open()) before re-opening if the alternative text was clicked. That is is someone first looked at the Terms and Conditions and then decided to look at the Privacy Policy, if that makes sense. Thus the function is as follows:


function F_OpenPDFWindow(NewWin)
{
if(PDF_PopUp!=undefined)
{
PDF_PopUp.close();
}
var PageContent=NewWin;
PDF_PopUp = window.open(PageContent, "pdfWindow","width=750,left=30,top=40,scrollbars");
}


This code works fine in Firefox, but as mentioned before, IE just throws and error stating "Permission denied". Have almost decided that I am going to have to completely re-think how I present this data!! Very frustrating so ... thanks for your help!

Sal;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.