Recently a friend asked small make up such a problem, first to everyone said the project needs: Scan two-dimensional code open app if the user does not have this app then prompts it to jump.
Using the Web page directly to invoke the app is not possible, you must first do some configuration.
First, the way Android and Apple are invoked is different.
So we need to judge the terminal first.
var u = navigator.useragent,
app = navigator.appversion;
var isandroid = u.indexof (' Android ') >-1 | | U.indexof (' Linux ') >-1; Android Terminal or UC browser
var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal
Then it is best to jump to two different pages to do the operation, because Apple needs to configure a App-id<meta in the head name= ' Apple-itunes-app ' content= ' app-id=1115968341 ' >
Here's the Apple code.
The ifr.src here is where you open the app's protocol path, and Android and Apple are different. <br><br><br> if it's Andro, it's easy.
This is our original demand, then changed, said that the Apple directly jump into the App store inside is good, do not open directly, Android words need to open directly.
So I'll just put them all together on a Web page.
I above the A link is a direct jump to Tencent application treasure inside.
Scanning with web pages is no problem,
But I felt that there would be an accident, and then took a micro-letter sweep on the force. Android will only open a link, jump not into the app, because it was intercepted by micro-letter, Apple is the same, the solution can only be clicked on the upper right corner, prompting the user to open the browser is no problem. This method is helpless, but then for the Apple machine to find a solution to its solution is, a link jump direct jump Tencent application treasure shelves of links, and then the micro-letter will be processed to help you automatically jump to the App store inside.
Finally, the code is integrated.
Add:
Scan two dimensional code jump app
1, to determine whether the installation of the app
2, open Project project target inside the Schemurl append://
The above is a small set to the introduction of the scanning two-dimensional code to open the app's implementation code, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!