• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 918
  • Last Modified:

Print the content of another frame in the frameset

Hello,

I have a frameset which contains 2 frames: the upper frame has a "Print" button and the lower frame contains data.
I have tries to print the data in the lower frame when pressing the button in the upper frame by using:

parent[1].focus();
parent[1].print();

but i get an "access denied" problem. Both frames are in the same domain...

How can i print the content of the lower frame?

Thanks,
Dana
0
Relegence
Asked:
Relegence
  • 9
  • 7
  • 3
  • +2
3 Solutions
 
TimYatesCommented:
shouldn't:

    parent[1].print();

be

    parent.frames[1].print();

?
0
 
RelegenceAuthor Commented:
No, i still get "Access Denied"
0
 
TimYatesCommented:
Do your frames have names?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
RelegenceAuthor Commented:
yes
0
 
TimYatesCommented:
you could try

    parent[ 'frameName' ].focus();
    parent[ 'frameName' ].print();

or

    parent.frameName.focus() ;
    parent.frameName.print() ;

Otherwise, I'm stumped :-/
0
 
RelegenceAuthor Commented:
Working with frames' names doesn't work either. i still get "Access Denied"
0
 
TimYatesCommented:
Can you post the FRAMESET definition?
0
 
RelegenceAuthor Commented:
still the same........... :-(
0
 
RelegenceAuthor Commented:
This is the FRAMESET definition:

<frameset rows="41,*" border=0 framespacing=0 frameborder=0>
      <frame name="viewerHeader" id="viewerHeader" src="viewerN.aspx" scrolling="no" noresize>
      <frameset cols="100%,0" id=lower border=0 framespacing=0 frameborder=0>
            <frame name="viewerBodyNew" id="viewerBodyNew" src="viewerBody.aspx" scrolling="auto" noresize>
            <frame name="viewerSummary" id="viewerSummary" src="Summary.aspx" scrolling="auto" noresize>
      </frameset>
</frameset>
0
 
LakioCommented:
can I see the page?
0
 
RelegenceAuthor Commented:
no, sorry :-(
It is internal..

But, the upper frame contains the next code:

<td align="right" valign="top" style="LEFT: 570px; POSITION: absolute; TOP: 0px">
      <a href="javascript:Print()"><img src="images/btn_email.gif" title="Print" border="0"></a>
</td>

and the javascript function:

function Print(what)
{
      parent[ 'viewerBodyNew' ].focus();
      parent[ 'viewerBodyNew' ].print();
}

0
 
TimYatesCommented:
Try changing:

      <a href="javascript:Print()"><img src="images/btn_email.gif" title="Print" border="0"></a>

to:

      <a href="#" onclick="doPrinting(); return false"><img src="images/btn_email.gif" title="Print" border="0"></a>

and

function Print(what)
{
     parent[ 'viewerBodyNew' ].focus();
     parent[ 'viewerBodyNew' ].print();
}

to

function doPrinting()
{
     parent[ 'viewerBodyNew' ].focus();
     parent[ 'viewerBodyNew' ].print();
}
0
 
RelegenceAuthor Commented:
Still the same... "Access Denied"
0
 
TimYatesCommented:
Right...last try...  can you try changing:

function doPrinting()
{
     parent[ 'viewerBodyNew' ].focus();
     parent[ 'viewerBodyNew' ].print();
}

to:

function doPrinting()
{
     top.viewerBodyNew.focus();
     top.viewerBodyNew.print();
}

?

Otherwise I'm stumped as to why this is happening :-(

Tim
0
 
bubbledragonCommented:
Make sure no any redirect script on your page. And the sites is not in the Restricted Sites zone.
0
 
ZvonkoSystems architectCommented:
You will get "Access Denied" as long as you get Cross Domain Access violation.
To find why you get Cross Domain Access condition at all check for this aspects:
1.) Are both frame URLs from same Internet domain?
2.) Is one frame URL without Internet domain suffix (only machine name)?
3.) Is one or both URLs nummeric instead sybolic names?
4.) Are both URLs same protocol (http/https)?
5.) Is one URL different port suffix, lik :8080

0
 
RelegenceAuthor Commented:
There is a redirect which is done in the lower frame 'viewerBodyNew' to another domain.

I get a URL in the lower frame and change the location of the frame to that URL:

document.location.href = theURL

In case this is the problem, is there a way to work around this?

Thanks,
Dana
0
 
ZvonkoSystems architectCommented:
No, there is NO way around the cross domain access protection.
0
 
bubbledragonCommented:
If redirect to outside sites, then is different domain too.

I view you use aspx, you can capture the outside sites html souce on server-side and become to your page under your domain.
0
 
TimYatesCommented:
>> you can capture the outside sites html souce on server-side and become to your page under your domain.

It depends how the page has been coded...  relative links to images/files/other URLS will give you a nightmare :-(

Tim
0
 
bubbledragonCommented:
Yes. If is sumbersome coding for files !!~
 If image file you can create a page and try to use <IMG SRC=""> to show the image, the security will not check this.
0
 
RelegenceAuthor Commented:
Thanks for all the answers,

We have given up the print function for now....
0

Featured Post

Independent Software Vendors: 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!

  • 9
  • 7
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now