Solved

Access is denied when trying to print a frame

Posted on 2004-04-27
6
808 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

813 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

15 Experts available now in Live!

Get 1:1 Help Now