• danA
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 days ago

    but it can place text into the clipboard.

    Only as the result of a user interaction, for example by pressing a button.

    • T156@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      From the Browser’s viewpoint, would there be any difference if the webpage has a JS button to put something in the clipboard, or it having code running in the background that puts things into the clipboard at page load?

      It’s not like there’s that much of a difference, as far as the Browser is concerned.

      • danA
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 days ago

        would there be any difference if the webpage has a JS button to put something in the clipboard, or it having code running in the background that puts things into the clipboard at page load?

        Clicking a button shows user intent, whereas a page load doesn’t. No user expects loading a page to overwrite their clipboard, but every user that clicks a “Copy to Clipboard” button does expect it.