Share Object on FireFox for Android possibly not working?

0 favourites
  • 5 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi, I have the built-in share plugin setup and it's working very well in Chrome on multiple platforms, but I am seeing a strange behavior in Firefox for Android and wanted to check if anyone else in the community is experiencing it.

    When I attempt to share in Firefox, the share menu appears but the content is always blank/empty. Whether I attempt to share w/ "Copy to clipboard", Messages, WhatsApp, etc... it says copied but there is nothing to paste.

    Thinking it may have been something with my code, I loaded up the "Taking Screenshot" example capx. On both Win10 & Android, Firefox displayed that File Sharing is not supported, as expected. So I modified the example capx and whittle it down to just a handful of events:

    On Start of Layout & (inverted) Is sharing supported THEN Set Text to "Sharing not supported"

    On Button Clicked THEN Share Text "Test Text"

    When loaded up on Win10, Firefox shows the text "Sharing not supported", as expected.

    When loaded up on Android, Firefox does not show this text, implying that sharing is supported. However, on button click, while the process appears to work, the share content is again blank/empty.

    Finally I added a check for share success on Android:

    On Share Completed THEN Set Text to "Share Completed"

    On Share Failed THEN Set Text to "Share Failed"

    When loaded up on Android, in both Chrome or Firefox, the share process itself succeeds, so the text shows "Share Completed". If I cancel out of the share process in either Firefox or Chrome, it shows "Share Failed", as expected.

    The big difference is that Chrome's share content correctly shows "Test Text", while Firefox's share content is blank/empty.

    I'm not sure where the content is being dropped or if I'm just doing something wrong, but wanted to see if anyone else has experienced this or has any ideas to resolve?

    For the mobile tests, I tested on two devices but unfortunately both were the same model/version:

    Pixel 6

    Android 13

    FireFox 105.2.0

    Thanks!

  • Share has limited support in Firefox, and is normally off by default

    developer.mozilla.org/en-US/docs/Web/API/Navigator/share

    caniuse.com/mdn-api_navigator_share

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you fredriksthlm!

    Quick follow-up, anyway to check for this support? So that I can hide the share button when it is off? The "Is sharing supported" check still comes back true in Firefox (at least in my tests).

    Thanks again!

  • I don't believe there is a built in test on this in any plugin (if it would have existed it would have been on the Browser plugin I guess). You can use navigator.userAgent

    developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent

    So you would need to do it in a javascript event, example here:

    stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browsers

  • Thanks fredriksthlm, I appreciate the details & links! I was also hoping it would be in something like the Browser object, but I'll take a look at if it's worth adding it as a javascript event. Thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)