Skip to content

I deploy it locally, Unable to get post URL from copy button #36

Closed

Description

@ellermister

test-copy-url

Navigator: clipboard property
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard

It is recommended to be compatible.

writeText: (text) => {
      let copyInput = document.createElement('input');
      copyInput.value = text;
      document.body.appendChild(copyInput);
      copyInput.select();
      document.execCommand('copy');
      document.body.removeChild(copyInput);
}

Activity

  1. Philipinho commented on Jul 1, 2024

    @Philipinho
    Member

    Which browser do you use?

  2. ellermister commented on Jul 1, 2024

    @ellermister
    Author

    Edge, http://xxxx

  3. olivierIllogika commented on Jul 19, 2024

    @olivierIllogika
    Contributor

    I ran into this too. You need a valid ssl certificate for the clipboard to work even for writing to it. The clipboard API is only available in secure contexts.

    A nice way to handle this would be to check window.isSecureContext and show an error in the notification instead of "Link copied".

  4. olivierIllogika commented on Jul 19, 2024

    @olivierIllogika
    Contributor

    @ellermister BTW, you can run from localhost without a valid ssl certificate. That's also considered a secure context.

    I think the issue is you're trying to run from your computer's IP instead of localhost or 127.0.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions