Android Alipay client HTML5 page can not automatically shut down the solution to the problem.

The company's products are paid by Alipay mobile web interface. When the three party merchants enter the jump address, jump to the address after the Alipay page is paid successfully, and if it fails, the page will be closed automatically.

During the test, it is OK on the IOS client, but not occasionally on the Android client.

Previous code:

By looking up the relevant JS API documents of Alipay page payment, the document describes that when the page is loaded, it will create AlipayJSBridge objects and trigger AlipayJSBridgeReady events.

From this sentence, we find the reason why web pages occasionally shut down in Alipay's Android client.

The reason why the alipayjsbridge cannot be closed is that when the alipayjsbridge. Call ('closewebview ') operation is executed, the alipayjsbridge has not been created, so it cannot be executed. Therefore, we need to listen to the alipayjsbridgeready event.

Resolution code:

The above code solves the problem perfectly, and automatically closes the page on Android and IOS Alipay mobile clients through testing.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>