Skip to content

Console errors on interaction on the demo page #174

Description

@Ryuno-Ki

After creating a demo page, clicking the share link results in an error in the browser console:

toastBox is not defined.

Also, it appears to see jQuery ($ is not defined) present, which is not the case.

Activity

  1. JulianPrieber commented on Oct 3, 2022

    @JulianPrieber
    Member

    The toast box is something that got removed previously. As far as I can tell, this issue is fixed with new releases.
    In case that it isn't I'll make sure this gets fixed.

    Also, it appears to see jQuery ($ is not defined) present, which is not the case.

    This one I'm not sure about. It should be something in here: https://github.com/JulianPrieber/littlelink-custom/blob/main/littlelink/js/share.button.js

  2. added
    bugSomething isn't working
    help wantedExtra attention is needed
    javascriptPull requests that update Javascript code
    on Oct 3, 2022
  3. Ryuno-Ki commented on Oct 3, 2022

    @Ryuno-Ki
    Author

    https://github.com/JulianPrieber/littlelink-custom/blob/3c4df6721c3faec1d20a0e2c4d946f12c8925663/littlelink/js/share.button.js#L65

    Could be rewritten as:

    document.querySelector('#share-share-button').addEventListener('click', () => {
      if (navigator.share) {
        navigator.share({
            title: '',
            text: '',
            url: '',
          })
          .then(() => console.log('Successful share'))
          .catch((error) => console.log('Error sharing', error));
      } else {
        console.log('Share not supported on this browser, do it the old way.');
      }
    });

    See also https://youmightnotneedjquery.com/#on

  4. JulianPrieber commented on Oct 4, 2022

    @JulianPrieber
    Member
  5. JulianPrieber commented on Oct 4, 2022

    @JulianPrieber
    Member

    This problem only appears on Firefox. The share button opens the system default share dialog on Chrome, but Firefox does not support that.

    chrome_d9qRIKykDr
    https://caniuse.com/?search=Navigator%20share

  6. locked and limited conversation to collaborators on Oct 31, 2022
  7. converted this issue into a discussion #199 on Oct 31, 2022
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

    bugSomething isn't workinghacktoberfesthelp wantedExtra attention is neededjavascriptPull requests that update Javascript code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions