Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access is denied when trying to print a frame

Posted on 2004-04-27
6
Medium Priority
?
814 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
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.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

636 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