Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【IOS WeChat 】No return data! #645

Closed
FeSeason opened this issue Apr 15, 2021 · 25 comments · Fixed by #654
Closed

【IOS WeChat 】No return data! #645

FeSeason opened this issue Apr 15, 2021 · 25 comments · Fixed by #654
Labels

Comments

@FeSeason
Copy link

Scenario

userAgent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.2(0x18000239) NetType/WIFI Language/zh_CN

  • use cdn last version sdk fingerprintjs@3
    <script>
      function initFingerprintJS() {

        // Initialize an agent at application startup.
        const fpPromise = FingerprintJS.load();

        // Get the visitor identifier when you need it.
        fpPromise
          .then((fp) => {
             // Here can get  fp
             return  fp.get()
           })
          .then((result) => {
            // No executed!! 

            // This is the visitor identifier:
            const visitorId = result.visitorId;
            alert(visitorId);
          });
      }
    </script>
    <script
      async
      src="//cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3/dist/fp.min.js"
      onload="initFingerprintJS()"
    ></script>

@Finesse Finesse added the bug label Apr 15, 2021
@Finesse
Copy link
Member

Finesse commented Apr 15, 2021

@FeSeason Thank you for the report. I'm not familiar with WeChat, so could you please give steps to reproduce?

@FeSeason
Copy link
Author

FeSeason commented Apr 15, 2021

AppLink【ios】: https://apps.apple.com/cn/app/wei/id414478124

  • Step 1,
    Copy the official case code and start local server

  • Step 2,
    Use WeChat to scan or open link in WeChat

  • Step 3,
    Problem found ..

@Finesse

@yuhonyon
Copy link

同样遇到 ios wechat 无返回

@caohongtao
Copy link

AppLink【ios】: https://apps.apple.com/cn/app/wei/id414478124

  • Step 1,
    Copy the official case code and start local server
  • Step 2,
    Use WeChat to scan or open link in WeChat
  • Step 3,
    Problem found ..

@Finesse

same problem in IOS WeChat

@Finesse
Copy link
Member

Finesse commented Apr 27, 2021

@FeSeason @yuhonyon @caohongtao I need your help. Please scan this QR with WeChat so that I can sign up and debug the issue:

image

What the WeChat application says

Contact a WeChat user who meets the following conditions.(They do not have to be your WeChat friend.)

a. Signed up for WeChat over 1 month ago if they are an international user or over 6 months ago if they are a Chinese Mainland user
b. Hasn't completed "Help Friend Register" for other users in the past month
c. Hasn't been blocked in the past month
d. Has activated WeChat Pay if they are a Chinese Mainland user

Ask them to scan the following QR code using WeChat.

@Finesse
Copy link
Member

Finesse commented Apr 28, 2021

Please give me access to WeChat or investigate the problem by yourself, otherwise I don't be able to help you. Please try to use NPM installation method and let me know if it helps.

@Perpherior
Copy link

Hi @Finesse, tried to scan the code but it says QR code is expired. Could you share a new one?

@Finesse
Copy link
Member

Finesse commented Apr 28, 2021

@Perpherior @FeSeason Lets try registration first. Please try this code:

D0E634A7-060F-4389-8640-18DA08F2C377

If I can’t register, then we will try to debug remotely.

@FeSeason
Copy link
Author

FeSeason commented Apr 28, 2021

@Perpherior @FeSeason Lets try registration first. Please try this code:

If I can’t register, then we will try to debug remotely.

Done!

@Finesse
Copy link
Member

Finesse commented Apr 28, 2021

@FeSeason Thank you! I’ll check the bug soon

@Finesse Finesse removed the needinfo label Apr 28, 2021
@Finesse
Copy link
Member

Finesse commented Apr 28, 2021

I've found the reason of the bug. The fontPreferences entropy source doesn't complete. It creates an iframe with an srcdoc attribute and waits for the iframe to load, but the iframe doesn't load in WeChat browser for some reason.

I've found a solution. If I move the iframe.srcdoc = initialHtml line below the document.body.appendChild(iframe) line, the iframe starts getting loaded and get() returns a result. I'll publish a fix soon.

@Finesse
Copy link
Member

Finesse commented Apr 28, 2021

The fix will be published in v3.1.1

@zerrol
Copy link

zerrol commented May 11, 2021

This problem was fixed in ios 14.x,but the problem still exisits in wechat with ios 13.x.
Please using wechat with ios 13.x . See this url: https://dev.hunliji.com/p/frontend/fingerprint-test/index.html.
You can see alert(visitorId); did not excute

code in this html :

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  hello
  <script>
    function initFingerprintJS() {

      // Initialize an agent at application startup.
      const fpPromise = FingerprintJS.load();

      alert('hello 0')
      // Get the visitor identifier when you need it.
      fpPromise
        .then((fp) => {
           // Here can get  fp
           alert('hello 1')
           return  fp.get()
         })
        .then((result) => {
          // No executed!!

          // This is the visitor identifier:
          const visitorId = result.visitorId;
          alert(visitorId);
        });
    }
  </script>
  <script
    async
    src="https://cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs@3.1.1/dist/fp.min.js"
    onload="initFingerprintJS()"
  ></script>

</body>
</html>

@zerrol
Copy link

zerrol commented May 11, 2021

@Finesse

@Finesse
Copy link
Member

Finesse commented May 12, 2021

Considering iOS 13. The fontPreferences and the fonts entropy sources don't complete. They create iframes and wait for the iframes to load, but the iframes don't load in WeChat browser for some reason. I've tried using both src and srcdoc, have tried changing the command order, nothing helps. Setting a real URL to the iframe src attribute helps, but making network requests isn't an option.

The solution that I've found is waiting until iframe.contentWindow.document.readyState becomes 'complete' (besides waiting for onload to fire). It fixes the problem in WeChat, keeps the correct iframe environment in Android Firefox and makes the source run faster in other browsers.

@zerrol Fixed by e11ed73. The fixed will be published in the next library release. If you need the fix soon, you can use the current master version: fp.min.js.zip.

@Finesse Finesse closed this as completed May 12, 2021
@Finesse
Copy link
Member

Finesse commented May 12, 2021

The problem happened in a Cordova application too (it uses WKWebView). The findings above are suitable for Cordova.

@Finesse Finesse reopened this Jun 1, 2021
@Finesse
Copy link
Member

Finesse commented Jun 1, 2021

The problem still happens in iOS 12.

@jyxu1016 Unfortunately, I don't have an iOS 12 device to debug, so you need to debug the issue by yourself. A probable reason is that an iframe loading promise never settles, therefore the withIframe function and the fonts and fontPreferences components never complete. You can check whether it's true on your device and try to find a way to know when the iframe is loaded to resolve the promise.

You can start your own FingerprintJS development playground to debug the issue: download the repository's code and follow the instructions. Once you start a playground and open it in WeChat, add alert()s to the source code to see what's going on.

I'll try to research the bug in a Cordova application on iOS 12 simulator, but it won't be a 100% reliable solution.

@jyxu1016
Copy link

jyxu1016 commented Jun 1, 2021

the problem also exisits in wechat with ios 13.x, read the comments above, this problem has always existed, IOS wechat is not available

@Finesse
Copy link
Member

Finesse commented Jun 1, 2021

@jyxu1016 I can't reproduce it on iOS 13.6.1 WeChat 8.0.6. I open https://fingerprintjs.github.io/fingerprintjs and see this:

@jyxu1016
Copy link

jyxu1016 commented Jun 1, 2021

I open https://fingerprintjs.github.io/fingerprintjs/ ,I can get it, too

But using the following is not executed

fpPromise
.then((fp) => {
// Here can get fp
alert('hello 1')
return fp.get()
})
.then((result) => {
// ----------》No executed!! 《-------------
const visitorId = result.visitorId;
alert(visitorId);
});

@Finesse
Copy link
Member

Finesse commented Jun 1, 2021

@jyxu1016 I've realized that the fix for iOS 13 hasn't been published yet, sorry. If you need the fix now, you can use the current master version: fp.min.js.zip. Please subscribe to the repository updates to get notified when the fix is published to NPM.

Could you please check whether https://fingerprintjs.github.io/fingerprintjs/ works in WeChat on iOS 12?

@jyxu1016
Copy link

jyxu1016 commented Jun 1, 2021

https://fingerprintjs.github.io/fingerprintjs/:it is available in WeChat on iOS 12
hope to published as soon as possible, thank

@Finesse
Copy link
Member

Finesse commented Jun 1, 2021

@jyxu1016 Thank you. I think we will publish it soon.

@jyxu1016
Copy link

@Finesse I'm waiting for you to publish every day

@Finesse
Copy link
Member

Finesse commented Jun 14, 2021

@jyxu1016 The fix has just been released in v3.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants