Access browser menu (copy/paste) from Javascript

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

    #1

    Access browser menu (copy/paste) from Javascript

    Is it possible to get browser-menu events (IE) into Javascript?

    I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v). Now
    the users would like to trigger it also from the browser menu.

  • Matt Kruse

    #2
    Re: Access browser menu (copy/paste) from Javascript

    Bani wrote:[color=blue]
    > I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v).
    > Now the users would like to trigger it also from the browser menu.[/color]

    <body onCopy="myfunc( )" onPaste="myfunc 2()">

    --
    Matt Kruse



    Comment

    • McKirahan

      #3
      Re: Access browser menu (copy/paste) from Javascript

      "Bani" <urban.spielman n@gmx.ch> wrote in message
      news:1112268346 .227496.80590@o 13g2000cwo.goog legroups.com...[color=blue]
      > Is it possible to get browser-menu events (IE) into Javascript?
      >
      > I have a special copy/paste on the onkeydown event (ctrl+c/ctrl+v). Now
      > the users would like to trigger it also from the browser menu.
      >[/color]

      What do you mean by "browser menu"?

      Browsers have Cut, Copy, and Paste functions under "Edit" on the Menu Bar.

      Or do you mean the right-click context menu?


      Comment

      • Bani

        #4
        Re: Access browser menu (copy/paste) from Javascript

        I haven't seen this two event-handlers in my documentation. But it
        works!

        Thank you.

        Does it work also for other browsers then IE?

        Comment

        • McKirahan

          #5
          Re: Access browser menu (copy/paste) from Javascript

          "Bani" <urban.spielman n@gmx.ch> wrote in message
          news:1112276414 .125479.243950@ o13g2000cwo.goo glegroups.com.. .[color=blue]
          > I haven't seen this two event-handlers in my documentation. But it
          > works!
          >
          > Thank you.
          >
          > Does it work also for other browsers then IE?
          >[/color]

          It works for me under FF and NS6.2.


          Comment

          • Csaba Gabor

            #6
            Re: Access browser menu (copy/paste) from Javascript

            Are you sure about that? onPaste has been logged as a Mozilla bug
            at https://bugzilla.mozilla.org/show_bug.cgi?id=280683
            (you can, however, mostly monitor a textbox/textarea for change in
            FF though the buggy method at
            https://bugzilla.mozilla.org/show_bug.cgi?id=285272)

            Also, I just tried the snippet below in my Firefox 1.0.1+ and got
            no alert boxes vs both alert firing for IE 6 (on my Win XP Pro).


            <body onpaste="alert( 'Body paste')">
            <form name=mine method=get action=''>
            <input name=tbtest onpaste="alert( 'Input paste')">
            </form>
            </body>

            Csaba Gabor from Vienna

            McKirahan wrote:[color=blue]
            > "Bani" <urban.spielman n@gmx.ch> wrote in message
            > news:1112276414 .125479.243950@ o13g2000cwo.goo glegroups.com.. .
            >[color=green]
            >>I haven't seen this two event-handlers in my documentation. But it
            >>works!
            >>
            >>Thank you.
            >>
            >>Does it work also for other browsers then IE?[/color]
            >
            > It works for me under FF and NS6.2.[/color]

            Comment

            • McKirahan

              #7
              Re: Access browser menu (copy/paste) from Javascript

              "Csaba Gabor" <csaba@z6.com > wrote in message
              news:%FW2e.1813 5$zY6.10443@new s.chello.at...[color=blue]
              > Are you sure about that? onPaste has been logged as a Mozilla bug
              > at https://bugzilla.mozilla.org/show_bug.cgi?id=280683
              > (you can, however, mostly monitor a textbox/textarea for change in
              > FF though the buggy method at
              > https://bugzilla.mozilla.org/show_bug.cgi?id=285272)
              >
              > Also, I just tried the snippet below in my Firefox 1.0.1+ and got
              > no alert boxes vs both alert firing for IE 6 (on my Win XP Pro).
              >
              >
              > <body onpaste="alert( 'Body paste')">
              > <form name=mine method=get action=''>
              > <input name=tbtest onpaste="alert( 'Input paste')">
              > </form>
              > </body>
              >
              > Csaba Gabor from Vienna
              >
              > McKirahan wrote:[color=green]
              > > "Bani" <urban.spielman n@gmx.ch> wrote in message
              > > news:1112276414 .125479.243950@ o13g2000cwo.goo glegroups.com.. .
              > >[color=darkred]
              > >>I haven't seen this two event-handlers in my documentation. But it
              > >>works!
              > >>
              > >>Thank you.
              > >>
              > >>Does it work also for other browsers then IE?[/color]
              > >
              > > It works for me under FF and NS6.2.[/color][/color]

              Here's what I used to test:

              <html>
              <head>
              <title>CopyPast e.htm</title>
              <script type="text/javascript">
              function myCopy() {
              alert("Copy");
              }
              function myPaste() {
              alert("Paste");
              }
              </script>
              </head>
              <body onCopy="myCopy( )" onPaste="myPast e()">
              <form>
              <textarea cols="50" rows="10">Hello World</textarea>
              </form>
              </body>
              </html>


              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: Access browser menu (copy/paste) from Javascript

                McKirahan wrote:
                [color=blue]
                > "Bani" <urban.spielman n@gmx.ch> wrote [...]:[color=green]
                >> I haven't seen this two event-handlers in my documentation. But it
                >> works!
                >>
                >> Thank you.
                >>
                >> Does it work also for other browsers then IE?[/color]
                >
                > It works for me under FF and NS6.2.[/color]

                However, it is not Valid HTML and as such not supposed to work generally.
                Relying on it is risky at best.


                PointedEars°
                --
                Messen, was messbar ist, und messbar machen, was noch nicht messbar ist.
                -- Galileo Galilei

                Comment

                Working...