javascript:print problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus Bjorke

    javascript:print problem

    I use a print link that causes a problem with Opera 7. The link looks
    like this <a href="javascrip t:parent.frames .mainFrame.prin t()">Print
    this page</a>

    I also used
    <a href="javascrip t:print()">Prin t this page</a>

    and it also worked with most browsers. I realize that it only works if
    you have Microsoft Windows versions for PC but that is what most of
    out customers have anyway. I have also noticed that there is a problem
    with certain browswers, for example Explorer 4 version but also with
    newer browser like Opera 7.01. I does work perfecly well with
    Mozilla-compatible browsers but why not with Opera. With Opera it
    first looks as if it would work, but when you choose print from the
    Operating system it prints the wrong frame although i specifically try
    to call the right frame. Has anyone found a workaroung or sollution to
    my problem.
  • Martin Honnen

    #2
    Re: javascript:prin t problem



    Marcus Bjorke wrote:
    [color=blue]
    > I use a print link that causes a problem with Opera 7. The link looks
    > like this <a href="javascrip t:parent.frames .mainFrame.prin t()">Print
    > this page</a>
    >
    > I also used
    > <a href="javascrip t:print()">Prin t this page</a>
    >
    > and it also worked with most browsers. I realize that it only works if
    > you have Microsoft Windows versions for PC but that is what most of
    > out customers have anyway. I have also noticed that there is a problem
    > with certain browswers, for example Explorer 4 version but also with
    > newer browser like Opera 7.01. I does work perfecly well with
    > Mozilla-compatible browsers but why not with Opera. With Opera it
    > first looks as if it would work, but when you choose print from the
    > Operating system it prints the wrong frame although i specifically try
    > to call the right frame. Has anyone found a workaroung or sollution to
    > my problem.[/color]


    Well, not every browser implements the window.print method (IE4 doesn't
    for instance) so you should check for it. It also helps to focus the
    frame you want to print
    <a href="#"
    onclick="if (window.print) {
    var frame = parent.frames.m ainFrame;
    if (frame) {
    frame.focus();
    frame.print();
    }
    }
    return false;">print frame</a>


    Note I haven't tested whether that improves things with Opera 7
    --

    Martin Honnen


    Comment

    • DU

      #3
      Re: javascript:prin t problem

      Martin Honnen wrote:[color=blue]
      >
      >
      > Marcus Bjorke wrote:
      >[color=green]
      >> I use a print link that causes a problem with Opera 7. The link looks
      >> like this <a href="javascrip t:parent.frames .mainFrame.prin t()">Print
      >> this page</a>
      >>
      >> I also used
      >> <a href="javascrip t:print()">Prin t this page</a>
      >>
      >> and it also worked with most browsers. I realize that it only works if
      >> you have Microsoft Windows versions for PC but that is what most of
      >> out customers have anyway. I have also noticed that there is a problem
      >> with certain browswers, for example Explorer 4 version but also with
      >> newer browser like Opera 7.01. I does work perfecly well with
      >> Mozilla-compatible browsers but why not with Opera. With Opera it
      >> first looks as if it would work, but when you choose print from the
      >> Operating system it prints the wrong frame although i specifically try
      >> to call the right frame. Has anyone found a workaroung or sollution to
      >> my problem.[/color]
      >
      >
      >
      > Well, not every browser implements the window.print method (IE4 doesn't
      > for instance) so you should check for it. It also helps to focus the
      > frame you want to print
      > <a href="#"
      > onclick="if (window.print) {
      > var frame = parent.frames.m ainFrame;
      > if (frame) {
      > frame.focus();
      > frame.print();
      > }
      > }
      > return false;">print frame</a>
      >
      >
      > Note I haven't tested whether that improves things with Opera 7[/color]

      I tried a slightly modified code

      <p><button type="button" onclick="top.Le ftFrameName.foc us();
      top.LeftFrameNa me.print();">Pr int left frame only</button></p>

      in a demo frameset+frames document
      and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
      left frame while Opera 7.21 printed each frames one after the other.
      Not too long ago, I asked in opera.general and opera.beta if it was
      possible to print an iframe only and it was confirmed it was not
      possible. So, I confidently believe that Opera 7.21 can not print an
      individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
      MSIE 6) can.

      DU

      Comment

      • Marcus Bjorke

        #4
        Re: javascript:prin t problem

        >[color=blue]
        > in a demo frameset+frames document
        > and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
        > left frame while Opera 7.21 printed each frames one after the other.
        > Not too long ago, I asked in opera.general and opera.beta if it was
        > possible to print an iframe only and it was confirmed it was not
        > possible. So, I confidently believe that Opera 7.21 can not print an
        > individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
        > MSIE 6) can.
        >
        > DU[/color]


        Thanks! Now i know not to bother with Opera anymore. Seems strange
        that the problem has been known so long but there is no sollution.

        /marcus

        Comment

        Working...