Solved

Access is denied when trying to print a frame

Posted on 2004-04-27
6
811 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to create an extensible mechanism for linked drop downs.
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…

726 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