Solved

Access is denied when trying to print a frame

Posted on 2004-04-27
6
806 Views
Last Modified: 2007-12-19
Hi
I'm getting an access is denied error in Internet Explorer when trying to print a frame.
The reason I need to print the frame and not the window is because I wan't to trigger Adobe Readers print function instead of IEs.
The script works fine if the html file is started from a directory and not on a web server.

Below is the code, if you try to change src of the frame to an object on your on harddrive the script will work.

<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="javascript">
function PrintFrame()
{
      frames['ContentFrame'].focus();
      frames['ContentFrame'].print();
}
</SCRIPT>
</HEAD>

<FRAMESET ROWS="*">
<FRAME name="ContentFrame" SRC="http://www.discraft.com/forms/center-waiver.pdf" onLoad='javascript:setTimeout("PrintFrame()", 500)'>
<!-- Increase the Timeout amount if no printing occurs -->
</FRAMESET>
</HTML>

/Kristoffer
0
Comment
Question by:PCK1978
  • 4
  • 2
6 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 10929372
You cannot print a frame which is other internet domain then the window where your print command is comming from.
I suppose your window is NOT  *.discraft.com domain.

Also if it  would be the same domain, so far my test go, I did not succeed in telling the pdf to print the window.
I got always the empty print page where pdf document was embedded.

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10929386
So the answer is: that cannot be done.
0
 

Author Comment

by:PCK1978
ID: 10929593
ok
That's true, when my file resides in a directory where my web server can access it my scripts work correct .
this frame works perfect if my page is i.e. 192.168.1.101/index.html
<FRAME name="ContentFrame" SRC="http://192.168.1.101/images/test.pdf" onLoad='javascript:setTimeout("PrintFrame()", 500)'>

Thx Zvonko
0
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

 
LVL 63

Accepted Solution

by:
Zvonko earned 125 total points
ID: 10929666
Why then do you not access it realtive to server root?

<FRAME name="ContentFrame" SRC="/images/test.pdf" onLoad='javascript:setTimeout("PrintFrame()", 500)'>

0
 

Author Comment

by:PCK1978
ID: 10929872
I used the server address because I tried different servers
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10930219
Why the grading B???
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

707 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

13 Experts available now in Live!

Get 1:1 Help Now