/    Sign up×
Community /Pin to ProfileBookmark

Accessing document object in a frame with a PDF

Hi…Hopefully someone explain this to me. I have an issue where I loop through some frames in a frameset and when I get to a frame that has a embedded PDF file as the source for that frame I get the following javascript error; “Access is denied”.

This issue is related to the mircrosoft cumulative secutiy update MS06-072. This I have confirmed; I can execute the code without the patch with no problems and then when its applied it fails. It also should fail if your running IE7, more than likely because this patch is already applied to IE7. I have no clue what it is in this security update that is causing this “Access is Denied” error. I would appreciate any insight into this so that i can get around it or at least why it occurs.

[url]http://support.microsoft.com/kb/925454[/url]

The error occurs in the javascript when it hits this line;

fp.frames[i].document

I am trying to access the document object on the frame and it gives me a error. I can access frame properties but i can’t access anything related to the document object on the frame with the embedded PDF.

I have attached the code below; sorry i tried to put attachments but its failing when i try to upload. Just copy the following code to produce; The files generated are clickHereFirst.html,frame_a.htm,frame_c.htm and a test2.pdf.

This is the first file that launches everything.
clickHereFrist.html

[CODE]
<head>
<script type=”text/javascript”>

function test1(){
test2(top);

}

function test2(fp){
for (var i=0; i<fp.length; i++){
var Obj = fp.frames[i].document;
}
}

</script>
</head>

<html>

<frameset rows=”15%,70%,15%”>

<frame src=”frame_a.htm”/>

<frame src=”test2.pdf”/>

<frame src=”frame_c.htm”/>

</frameset>

</html>
[/CODE]

  • 2. Frame_a.htm
    [CODE]
    <head>

    </head>
    <html>
    FRAME 1
    </html>
    [/CODE]

  • 3. Frame_c.htm
    [CODE]
    <head>

    </head>
    <html>

    Frame 3
    <form>
    <input type=”button” value=”TEST” onclick=”parent.test1();”>
    </form>
    </html>
    [/CODE]

  • 4. test2.pdf
  • For this just create a blank txt file and rename it as a pdf. It doesn’t have to
    have any content so long as its a pdf.

    Sorry for the long post and thank you to anyone who can help.

    to post a comment
    JavaScript

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @konithomimoFeb 02.2007 — You will not get around this. The update basically disabled all access to contentDocuments, to prevent people from accesing data on other sites and manipulating them, or abusing them.
    Copy linkTweet thisAlerts:
    @mcconnell55authorFeb 02.2007 — Ok thanks, I ddin't think there was. I have a solution but Its not very dynamic. For anyone else who has this problem you can try one of two things;

    1) Take the name of your frame and use a if statement to ignore that particular frame.

    2) Try Catch should work and just keep on going.

    I just don't like relying hardcoded values and a process flow that uses an error to continue but at least with the try catch its dynamic.
    ×

    Success!

    Help @mcconnell55 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.15,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...