schemes-universalLink-share_IOS-android-WeChat-chunleiDemo

schemes-universalLink-share_IOS-android-WeChat-chunleiDemo


     The mobile terminal share page start APP people vomiting pit, personal summary, I hope you take some small pits. The program provides the current popular H5 page on the market to start the APP way.      The code for the startup APP is located in the ShareAPP.js file. If not too clear, welcome to communicate with me, my mailbox chunlei201536@outlook.com.android

//  ios9如下以及安卓的啓動方式爲  schemes
    var $ios9_lev =  IOS_schemes; //app程序協議,可對應調取打開相應app  
    var $android_url = Android_schemes;
//  啓動微信商城
    var $wx_url = wxsc_url;
//  ios9以上經過universal_link啓動app,主要配置組要ios程序猿完成
/*
注意:
    和Web端的同窗一開始怎麼也搞不定點擊按鈕跳轉,找了很久終於發現爲了提升手機端Web頁面的點擊響應速度,咱們的Web端默認是使用touch事件來代替click的,可是在Universal Links的跳轉中必須使用click。 
    另外,頁面初始頁和要跳轉的頁的域名必須是不一樣的,不然這個跳轉事件也不會調起對應的App!(曾經本人陷入此坑不能自拔,哎!說多了都是淚)另外,在進行Universal Links的調試時,建議先刪除App,而後從新編譯,運行。
*/
    var $universal_link = universal_link;
if(/android/i.test(navigator.userAgent)) {
        //android端  
        if(navigator.userAgent.match(/MicroMessenger/i) != 'MicroMessenger') {
            // 安卓非微信端
        } else {
            //  安卓微信端
        }
    } else if(/ipad|iphone/i.test(navigator.userAgent)) {
        //  ios端
        if(navigator.userAgent.match(/MicroMessenger/i) != 'MicroMessenger') {
        //  ios非微信端
            //判斷ios版本
            var ver = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
            ver = parseInt(ver[1], 10);
            if(ver < 9) {
                //  ios版本小於9時  
            } else {
                // ios版本大於9時
            }
        } else {
            // ios微信端     
        }
    } else {
        //pc端訪問
    }

詳細demo見github:https://github.com/chunlei36/schemes-universalLink-share_IOS-android-WeChat-chunleiDemo.gitios

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息