javascript:close() for tab in Firefox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • petcancervet@gmail.com

    javascript:close() for tab in Firefox

    I am writing a PHP/MySQL web-page based system on Firefox and wish to
    run a separate page from an <Alink to run a separate PHP script,
    then close that page. Firefox starts a new tab for this and it closes
    OK but I am then left with an egg-timer at the mouse arrow when over
    top or bottom toolbars areas of the parent page.

    I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
    I have tried opener.focus() with no effect.

    I can't tell what is running. It doesn't happen with IE.

    Any explanation/solution?

    Ron Lowe
  • Erwin Moller

    #2
    Re: javascript:clos e() for tab in Firefox

    petcancervet@gm ail.com schreef:
    I am writing a PHP/MySQL web-page based system on Firefox and wish to
    run a separate page from an <Alink to run a separate PHP script,
    then close that page. Firefox starts a new tab for this and it closes
    OK but I am then left with an egg-timer at the mouse arrow when over
    top or bottom toolbars areas of the parent page.
    >
    I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
    I have tried opener.focus() with no effect.
    That is no valid eventhandler.
    It is pseudoprotocol for <a href="javascrip t:...">
    Never use it.

    To get your onload handler working simply use:
    <body onLoad="someFun ction();">

    and define someFunction() elsewhere.
    You can also put the direct javascript commands into the onLoad handler.

    >
    I can't tell what is running. It doesn't happen with IE.
    IE sucks in its own way.
    >
    Any explanation/solution?
    >
    Ron Lowe
    Regards,
    Erwin Moller

    Comment

    • SAM

      #3
      Re: javascript:clos e() for tab in Firefox

      petcancervet@gm ail.com a écrit :
      I am writing a PHP/MySQL web-page based system on Firefox and wish to
      run a separate page from an <Alink to run a separate PHP script,
      then close that page. Firefox starts a new tab for this and it closes
      OK but I am then left with an egg-timer at the mouse arrow when over
      top or bottom toolbars areas of the parent page.
      >
      I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
      <body onload="self.cl ose();">

      What is the interest to load a page if it is to close it immediately ?

      <body onload="setTime out(self.close, 200);">

      Usually when the pop-up-tab is closed you come back to the opener tab.
      There is no reason to get egg-timer nor wheel

      What does the error console of Fx say ?
      I have tried opener.focus() with no effect.
      too late ?
      Any explanation/solution?
      what is supposed the "separate" php to do ?
      can't it close the window (tab) itself ?
      (instead of onload in body tag)


      in opener try with your link :

      <a href="page.php" target="other" onmouseup="this .blur();">


      <a href="page.php"
      onclick="window .open(this.href );this.blur();r eturn false;">
      and don't forget ............... ............... ^^^^^^^^^^^^^

      --
      sm

      Comment

      • Joost Diepenmaat

        #4
        Re: javascript:clos e() for tab in Firefox

        Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
        petcancervet@gm ail.com schreef:
        >I am writing a PHP/MySQL web-page based system on Firefox and wish to
        >run a separate page from an <Alink to run a separate PHP script,
        >then close that page. Firefox starts a new tab for this and it closes
        >OK but I am then left with an egg-timer at the mouse arrow when over
        >top or bottom toolbars areas of the parent page.
        >>
        >I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
        >I have tried opener.focus() with no effect.
        >
        That is no valid eventhandler.
        yes it is. in this case, Javascript: is interpreted as a label. it's
        just useless.


        --
        Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

        Comment

        • Erwin Moller

          #5
          Re: javascript:clos e() for tab in Firefox

          Joost Diepenmaat schreef:
          Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
          >
          >petcancervet@gm ail.com schreef:
          >>I am writing a PHP/MySQL web-page based system on Firefox and wish to
          >>run a separate page from an <Alink to run a separate PHP script,
          >>then close that page. Firefox starts a new tab for this and it closes
          >>OK but I am then left with an egg-timer at the mouse arrow when over
          >>top or bottom toolbars areas of the parent page.
          >>>
          >>I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
          >>I have tried opener.focus() with no effect.
          >That is no valid eventhandler.
          >
          yes it is. in this case, Javascript: is interpreted as a label. it's
          just useless.
          >
          Hi,

          OK, thanks for correcting that. I didn't know that.

          Is there ANY use ever for javascript: ??
          (I don't want to advise people to avoid it if it has actual use
          somewhere/somehow.)

          Regards,
          Erwin Moller

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: javascript:clos e() for tab in Firefox

            Joost Diepenmaat wrote:
            Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
            >petcancervet@gm ail.com schreef:
            >>I am writing a PHP/MySQL web-page based system on Firefox and wish to
            >>run a separate page from an <Alink to run a separate PHP script,
            >>then close that page. Firefox starts a new tab for this and it closes
            >>OK but I am then left with an egg-timer at the mouse arrow when over
            >>top or bottom toolbars areas of the parent page.
            >>>
            >>I am using <BODY onLoad='Javascr ipt:close()'to fire the tab closure.
            >>I have tried opener.focus() with no effect.
            >That is no valid eventhandler.
            >
            yes it is. in this case, Javascript: is interpreted as a label. it's
            just useless.
            To be precise, it is not an event handler, valid or otherwise. It is the
            value of an intrinsic *event handler attribute*. The value, which type is
            CDATA, is supposed to be a string value representing code written in an
            ECMAScript implementation here (because such a language appears to be the
            default scripting language in past and current HTML UAs).

            Whether `javascript:' constitutes syntactically valid ECMAScript-compliant
            code depends on the implementation used: ECMAScript before Edition 3 did not
            specify the LabelStatement production. So strictly speaking, it is e.g. not
            valid (by any standards you want to apply) in Netscape before version 4.0,
            and Microsoft Internet Explorer before version 4.0, because the ECMAScript
            implementations they supported did not support that particular feature yet.




            PointedEars
            --
            Anyone who slaps a 'this page is best viewed with Browser X' label on
            a Web page appears to be yearning for the bad old days, before the Web,
            when you had very little chance of reading a document written on another
            computer, another word processor, or another network. -- Tim Berners-Lee

            Comment

            • Evertjan.

              #7
              Re: javascript:clos e() for tab in Firefox

              Erwin Moller wrote on 14 mei 2008 in comp.lang.javas cript:
              Is there ANY use ever for javascript: ??
              (I don't want to advise people to avoid it if it has actual use
              somewhere/somehow.)
              >
              Yes.

              1 In favelets/bookmarklets.

              2 In an [IE only] vbscript using page, to call sporadic js:

              =============== =========
              <script type='text/vbscript'>
              document.write "Hello<br>"
              i = 7
              </script>

              <div onclick = 'javascript:ale rt(++i);'>
              Click me!
              </div>
              =============== =========

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Joost Diepenmaat

                #8
                Re: javascript:clos e() for tab in Firefox

                Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
                Is there ANY use ever for javascript: ??
                (I don't want to advise people to avoid it if it has actual use
                somewhere/somehow.)
                IIRC the purpose of the javascript: URLs (and URLs only) is to call a
                JS function that returns the content of a page/image/whatever. IOW you
                could use it to generate an image or page on the fly. Which won't work
                for event handlers, since event attribute values aren't URLs.

                For instance: <a href="javascrip t:'bla'">click</a>

                --
                Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                Comment

                • Joost Diepenmaat

                  #9
                  Re: javascript:clos e() for tab in Firefox

                  Joost Diepenmaat <joost@zeekat.n lwrites:
                  Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
                  >
                  >Is there ANY use ever for javascript: ??
                  >(I don't want to advise people to avoid it if it has actual use
                  >somewhere/somehow.)
                  >
                  IIRC the purpose of the javascript: URLs (and URLs only) is to call a
                  JS function
                  ^^^^^^^^ or direct code. it seems to work more or less like eval()
                  in that regard...
                  that returns the content of a page/image/whatever. IOW you
                  could use it to generate an image or page on the fly. Which won't work
                  for event handlers, since event attribute values aren't URLs.
                  >
                  For instance: <a href="javascrip t:'bla'">click</a>
                  --
                  Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: javascript:clos e() for tab in Firefox

                    Joost Diepenmaat wrote:
                    Joost Diepenmaat <joost@zeekat.n lwrites:
                    >Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
                    >>Is there ANY use ever for javascript: ??
                    >>(I don't want to advise people to avoid it if it has actual use
                    >>somewhere/somehow.)
                    >IIRC the purpose of the javascript: URLs (and URLs only) is to call a
                    >JS function
                    ^^^^^^^^ or direct code. it seems to work more or less like eval()
                    in that regard...
                    It is described how it is supposed to work, and that appears to match the
                    implementations ' behavior. I have posted the description in another thread
                    *today*, so there really is no need to post your wild assumptions.


                    PointedEars
                    --
                    realism: HTML 4.01 Strict
                    evangelism: XHTML 1.0 Strict
                    madness: XHTML 1.1 as application/xhtml+xml
                    -- Bjoern Hoehrmann

                    Comment

                    • Joost Diepenmaat

                      #11
                      Re: javascript:clos e() for tab in Firefox

                      Thomas 'PointedEars' Lahn <PointedEars@we b.dewrites:
                      Joost Diepenmaat wrote:
                      >Joost Diepenmaat <joost@zeekat.n lwrites:
                      >>Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
                      >>>Is there ANY use ever for javascript: ??
                      >>>(I don't want to advise people to avoid it if it has actual use
                      >>>somewhere/somehow.)
                      >>IIRC the purpose of the javascript: URLs (and URLs only) is to call a
                      >>JS function
                      > ^^^^^^^^ or direct code. it seems to work more or less like eval()
                      >in that regard...
                      >
                      It is described how it is supposed to work, and that appears to match the
                      implementations ' behavior. I have posted the description in another thread
                      *today*, so there really is no need to post your wild assumptions.
                      A link to a description to how it's "supposed to work" would be
                      nice. It's unsurprisingly hard to search for this behaviour because of
                      the keywords involved.

                      --
                      Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: javascript:clos e() for tab in Firefox

                        Joost Diepenmaat wrote:
                        Thomas 'PointedEars' Lahn <PointedEars@we b.dewrites:
                        >Joost Diepenmaat wrote:
                        >>Joost Diepenmaat <joost@zeekat.n lwrites:
                        >>>Erwin Moller <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrites:
                        >>>>Is there ANY use ever for javascript: ??
                        >>>>(I don't want to advise people to avoid it if it has actual use
                        >>>>somewhere/somehow.)
                        >>>IIRC the purpose of the javascript: URLs (and URLs only) is to call a
                        >>>JS function
                        >> ^^^^^^^^ or direct code. it seems to work more or less like eval()
                        >>in that regard...
                        >It is described how it is supposed to work, and that appears to match the
                        >implementation s' behavior. I have posted the description in another thread
                        >*today*, so there really is no need to post your wild assumptions.
                        >
                        A link to a description to how it's "supposed to work" would be
                        nice. It's unsurprisingly hard to search for this behaviour because of
                        the keywords involved.
                        It isn't.



                        (Well, I have been off by 7 minutes ...)


                        PointedEars
                        --
                        Prototype.js was written by people who don't know javascript for people
                        who don't know javascript. People who don't know javascript are not
                        the best source of advice on designing systems that use javascript.
                        -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                        Comment

                        • Joost Diepenmaat

                          #13
                          Re: javascript:clos e() for tab in Firefox

                          Thomas 'PointedEars' Lahn <PointedEars@we b.dewrites:
                          >A link to a description to how it's "supposed to work" would be
                          >nice. It's unsurprisingly hard to search for this behaviour because of
                          >the keywords involved.
                          >
                          It isn't.
                          >
                          <http://groups.google.com/groups?as_q...num=10&scoring
                          =r&as_epq=&as_o q=&as_eq=&as_ug roup=comp.lang. javascript&as_u subject=&
                          as_uauthors=Poi ntedEars&lr=&as _qdr=&as_drrb=b &as_mind=13&as_ minm=5&
                          as_miny=2008&as _maxd=14&as_max m=5&as_maxy=200 8>

                          Neither of the two pages you mention in that post is in the first 100
                          results on a google search of '"javascript url"' (with quotes) or
                          'javascript url' (without quotes) for me. And not to be annoying, but
                          it looks to me like those pages are describing browser behaviour as it
                          was whenever they were written instead of any kind of standard (not
                          that there's anything wrong with that).

                          Anyway, thanks.

                          Joost.


                          --
                          Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                          Comment

                          • petcancervet@gmail.com

                            #14
                            Re: javascript:clos e() for tab in Firefox

                            Thanks, guys (& gals but I didn't notice any)

                            That got rather esoteric.

                            Just to be annoying I have rewritten the code using IFRAME instead!
                            The point with the PHP is that I have to fire code to set up a new
                            MySQL table but then return to the submitting page as it was.
                            Reloading PHP pages leads to very complicated if {}s and becomes
                            unintelligible.

                            Cheers

                            Ron

                            Comment

                            Working...