PDA

View Full Version : Getting "Access Denied Error" printing a frame via top.frames['framename'].print()


taharka
10-22-2002, 09:12 PM
Hi all.

I'm getting the stated error when I attempt to print a frame via a button click on anther frame.

For example:

Frame1 contains a button named printButton.
The onClick for printButton is:onClick="javascript:top.frames[1].print()"
Frame2 contains some data.

When the user clicks printButton I get the following javascript error:

Error: Access is denied
Code: 0

Any hints on why this is happening?

By the way, this apparently worked under Netscape. We are now launching under IE5.5. Thanks in advance for any help.

beetle
10-22-2002, 10:19 PM
Uhh, that sounds like an error generated by the browser's frame security. Are both of the frame pages within the same domain?

(looking at this files locally will likely cause the security issue too)

Quiet Storm
10-23-2002, 02:13 AM
Try this:

onClick="javascript:window.frames['1'].focus();window.frames['1'].print();"

Works for me on IE5.0+....

taharka
10-23-2002, 02:24 PM
Thanks for the help so far. We discovered something that may very well be the culprit. As it turns out, the source being generated for the second frame has no HTML in it whatsoever. I'm surprised it displays on the screen, however it may be the reason the browser is unable to access the second layer. When I modify it to include a valid HTML file as the src of the second frame, all printing issues goes away.

So, we now believe there is an issue with our mainframe job and/or JSP that is supposed to generate our HTML file.

Thanks again for your help.

taharka
10-24-2002, 07:12 PM
Does anyone have any comments on this microsoft post?

Q324020 (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q324020)

Turns out this is the issue rather than what was mentioned in my previous post. Can't seem to apply the work arounds.

Please help