Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access is denied when trying to print a frame

Posted on 2004-04-27
6
Medium Priority
?
816 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Accepted Solution

by:
Zvonko earned 375 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

810 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