new window full screen

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

    new window full screen

    Is there a javascript statement which can be incorporated in a
    hyperlink which will open a new page that fills the screen while
    leaving the page with the link open?

    Thanks in advance.
    CW
  • Harag

    #2
    Re: new window full screen

    On Tue, 31 Aug 2004 15:28:37 GMT, pow67 <pow67@optonlin e.net> wrote:
    [color=blue]
    >Is there a javascript statement which can be incorporated in a
    >hyperlink which will open a new page that fills the screen while
    >leaving the page with the link open?
    >
    >Thanks in advance.
    >CW[/color]



    <a href="newfile.h tml" target="newwin"
    onclick="window .open(this.href , this.target, 'fullscreen'); return
    false">Click me</a>


    Note: fullscreen is IE only.

    HTH

    Al.

    Comment

    • pow67

      #3
      Re: new window full screen

      Thanks.
      The script below works in IE but not Netscape- Any ideas?


      <SCRIPT LANGUAGE="JavaS cript">
      <!--

      function maximizeWin() {
      if (window.screen) {
      var aw = screen.availWid th;
      var ah = screen.availHei ght;
      window.moveTo(0 , 0);
      window.resizeTo (aw, ah);
      }
      }

      // -->
      </SCRIPT>


      <a href="myTestPag e.htm" target="_blank" onclick="maximi zeWin
      ()">Click Here</a></p>

      Comment

      • pow67

        #4
        Re: new window full screen

        Correction. The script in previous message works in Netscape but not IE.

        Thanks in advance.

        CW

        Comment

        • Harag

          #5
          Re: new window full screen

          On Tue, 31 Aug 2004 18:44:55 GMT, pow67 <pow67@optonlin e.net> wrote:
          [color=blue]
          >Correction. The script in previous message works in Netscape but not IE.
          >
          >Thanks in advance.
          >
          >CW[/color]

          I use the below script for NS7 & IE6.

          <a href="filename. asp" target="newwin"
          onclick="newWin dow(this.href,t his.target,
          -1,-1,'yes','yes',0 ,0,'',false); return false;">click me</a>

          HTH

          Al.



          function newWindow(sFile nameToView, sWindowName, iWidth, iHeight,
          sCanScroll, bCanResize, iLeft, iTop, sExtraSettings, bReplaceHistory )
          {
          var oNewWin = null;
          if (!sExtraSetting s) {sExtraSettings ='';}
          // iWidth/iHeight=-1 for netscape to go "near as damit" full
          screen
          // NS user needs to press F11 to go true full screen.
          if (iWidth == -1 || iHeight == -1) {
          sExtraSettings =
          sExtraSettings. replace(/fullscreen/gi, '');
          if (sExtraSettings ) {sExtraSettings += ',';}
          sExtraSettings += 'fullscreen, outerWidth=' +
          screen.width + ', outerHeight=' + screen.height;
          iLeft = 0;
          iTop = 0;
          }
          var iLeftPosition = iLeft;
          var iTopPosition = iTop;
          // iLeft/iTop=-1 centers the newwindow on the screen
          if (iLeft == -1 || iTop == -1) {
          iLeftPosition = (screen.availWi dth) ?
          (screen.availWi dth - iWidth) / 2 : 0;
          iTopPosition = (screen.availHe ight) ?
          (screen.availHe ight - iHeight) / 2 : 0;
          }

          var sWindowSettings = 'height=' + iHeight + ',width=' + iWidth
          + ',top=' + iTopPosition + ',left=' + iLeftPosition + ',scrollbars=' +
          sCanScroll + ',resizable=' + bCanResize + ',' + sExtraSettings;
          oNewWin = window.open(sFi lenameToView, sWindowName,
          sWindowSettings , bReplaceHistory );
          oNewWin.focus() ;
          return oNewWin;
          }

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: new window full screen

            pow67 wrote:
            [color=blue]
            > Is there a javascript statement which can be incorporated in a
            > hyperlink which will open a new page that fills the screen while
            > leaving the page with the link open?[/color]

            Yes, however it uses a feature of the DOM, not the core
            language and so it is likely not to work in all UAs:

            <a href="foo.html"
            onclick="window .open(this.href , ..., "fullscreen "); return false;"[color=blue]
            >...</a>[/color]

            Note that fullscreen, if it works, may result in undesired presentation.
            Use Google Groups for details.


            PointedEars
            --
            completely foolproof was to underestimate the ingenuity of complete fools.

            Comment

            • Randy

              #7
              Re: new window full screen

              1) <a href="javascrip t: void();" onclick="window .open('new_wind ow.htm',
              'new_window','t oolbar=no, status=no, menubar=no, resizeable=no') " > new
              widow </a>

              2) then, in the new_window.htm -- a wee bit of JS:

              <head>
              <script language="javas cript" type="text/javascript">
              self-resizeTo(screen .width,screen.h eight);
              self-moveTo(0,0);
              </script>
              </head>

              3) to provide the new window with an easy way out (other than the 'X' Close
              in the upper right) provide for the use a <<back or <<home>> link (which
              actually just closes the window, allowing the initial window to re-appear);
              otherwise, you've got just another annoying pop-up:

              <a href="window.cl ose()"> back </a>

              4) make sure all your JS is in a single line: breaks, returns and <br> can
              cause JS errors


              Randy.


              Comment

              • Michael Winter

                #8
                Re: new window full screen

                On Thu, 9 Sep 2004 23:26:32 -0600, Randy <RPL999@yahoo.c om> wrote:

                Sorry to berate you, but there are obvious errors here that you should
                have found had you tested what you posted.
                [color=blue]
                > 1) <a href="javascrip t: void();" onclick="window .open('new_wind ow.htm',
                > 'new_window','t oolbar=no, status=no, menubar=no, resizeable=no') " > new
                > widow </a>[/color]

                The feature string cannot contain spaces. It's also a bad idea to prevent
                resizing (which you spelt incorrectly). Replace it with:

                'resizable,scro llbars'

                You should also avoid javascript URIs unless you have a *good* reason to
                use them.

                <a href="new_windo w.html" target="new_win dow"
                onclick="window .open(this.href ,this.target,'r esizable,scroll bars');return
                false;"[color=blue]
                > new window</a>[/color]
                [color=blue]
                > 2) then, in the new_window.htm -- a wee bit of JS:
                >
                > <head>
                > <script language="javas cript" type="text/javascript">[/color]

                The language attribute is deprecated and shouldn't be used. The presence
                of the type attribute also makes it unnecessary.
                [color=blue]
                > self-resizeTo(screen .width,screen.h eight);
                > self-moveTo(0,0);[/color]

                That will cause an error, greatly annoy large or multi-monitor users, and
                fail to work at all (assuming the dashes were dots) in all my browsers
                except IE (which I only use to test, anyway).

                [snip]
                [color=blue]
                > otherwise, you've got just another annoying pop-up:[/color]

                All pop-ups are annoying, whether a close button is present or not.
                [color=blue]
                > <a href="window.cl ose()"> back </a>[/color]

                You certainly didn't test that.

                [snip]

                Please read the group FAQ (<URL:http://jibbering.com/faq/>), and test what
                you post.

                Mike

                --
                Michael Winter
                Replace ".invalid" with ".uk" to reply by e-mail.

                Comment

                • Grant Wagner

                  #9
                  Re: new window full screen

                  Michael Winter wrote:
                  [color=blue][color=green]
                  > > 2) then, in the new_window.htm -- a wee bit of JS:
                  > >
                  > > <head>
                  > > <script language="javas cript" type="text/javascript">[/color]
                  >
                  > The language attribute is deprecated and shouldn't be used. The presence
                  > of the type attribute also makes it unnecessary.
                  >[color=green]
                  > > self-resizeTo(screen .width,screen.h eight);
                  > > self-moveTo(0,0);[/color]
                  >
                  > That will cause an error, greatly annoy large or multi-monitor users, and
                  > fail to work at all (assuming the dashes were dots) in all my browsers
                  > except IE (which I only use to test, anyway).[/color]

                  Even if it were written correctly, it still won't do anything in my browser,
                  where resizeTo() and moveTo() have no effect at all. Well, they have an
                  effect, when I realize the site author is trying to control the size and
                  position of my browser window, I chuckle a bit at my victory over their lame
                  attempt to enforce their will upon me.

                  --
                  Grant Wagner <gwagner@agrico reunited.com>
                  comp.lang.javas cript FAQ - http://jibbering.com/faq

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: new window full screen

                    Randy wrote:
                    [color=blue]
                    > 1) <a href="javascrip t: void();" onclick="window .open('new_wind ow.htm',
                    > 'new_window','t oolbar=no, status=no, menubar=no, resizeable=no') " > new
                    > widow </a>[/color]

                    This is utter nonsense.

                    1. URIs must not contain whitespace, the ":" within the "href"
                    attribute value should not be followed by a space character.

                    2. "void" is a special operator, not a method; it requires an
                    operand that "()" does not provide. As the "click" event
                    is not canceled, this URI will cause a script error.

                    3. This link will not work if client-side scripting is absent;
                    either an error message from the UA will occur or just nothing
                    will happen.

                    4. The third argument of window.open() must not contain spaces,
                    so the features of the new window will not be applied here.
                    [color=blue]
                    > 2) then, in the new_window.htm -- a wee bit of JS:
                    >
                    > <head>
                    > <script language="javas cript" type="text/javascript">
                    > self-resizeTo(screen .width,screen.h eight);
                    > self-moveTo(0,0);
                    > </script>
                    > </head>[/color]

                    More nonsense.

                    1. Valid HTML requires a "title" element as child of the "head element.

                    2. The "language" attribute is deprecated. Using the required "type"
                    attribute value removes the need for using the former.

                    3. Object reference and method identifier are to be separated by the lookup
                    operator ".", not the substraction operator "-". Here, a substraction of
                    an object reference (self) by the *result* of the resizeTo() method will
                    be performed, resulting in a NaN (not a number) value that is discarded.
                    It only works because in many UAs, "self" is a reference to the current
                    Window object, which is also the global object;

                    resizeTo(screen .width,screen.h eight);
                    moveTo(0,0);

                    would also work and would avoid the useless operation.

                    4. Display resolution != desktop size != browser window size
                    != viewport size. [psf 3.7]

                    5. Recent browsers allow these particular features of client-side
                    scripting to be disabled.
                    [color=blue]
                    > 3) to provide the new window with an easy way out (other than the 'X'
                    > Close in the upper right) provide for the use a <<back or <<home>> link
                    > (which actually just closes the window, allowing the initial window to
                    > re-appear); otherwise, you've got just another annoying pop-up:
                    >
                    > <a href="window.cl ose()"> back </a>[/color]

                    Nonsense. This link will do nothing, since there is not recource with
                    that URL (and can't be, see RFC 2396). The "href" attribute value must be
                    prefixed with "javascript :" or, even better, the "onclick" handler should
                    be used and the link should be written dynamically using DOM methods.
                    [color=blue]
                    > 4) make sure all your JS is in a single line: breaks, returns and <br>
                    > can cause JS errors[/color]

                    Nonsense. Understanding how automatic semicolon insertion works in
                    ECMAScript implementations and, even better, not to rely on it, helps to
                    understand why some code works and another does not. Basic knowledge on
                    how to use the debugging features of an UA also helps to find such errors.
                    Generally, there are no known errors to be caused by whitespace of any
                    kind within script code, which is in accordance to both the HTML 4.01 and
                    the ECMAScript Specification. Only in XHTML an attribute value should not
                    span several lines, so it is best to put script code in a single line if
                    it is used in an intrinsic event handler's attribute value; however,
                    maintenance efforts of complex statements usually decrease if they are
                    moved into a method and this method is called instead; this often removes
                    the need for several lines of code within the attribute value.

                    Please RTFM before posting more of such nonsense, thanks.


                    PointedEars
                    --
                    Don't throw houses when you live in a glass stone.

                    Comment

                    Working...