cari

Rumah  >  Soal Jawab  >  teks badan

电商项目中webview如何与activity传值交互

在一个电商项目中用一个webview加载html商品列表,然后点击其中某个商品跳转activity呈现详情,请问这怎么传值,还有就是activity如何向html传值,改变一些参数

高洛峰高洛峰2951 hari yang lalu630

membalas semua(1)saya akan balas

  • 三叔

    三叔2016-11-03 10:20:07

    var deviceType = "{$device}";//{$device}为获取是Android还是ios
                $(".item").click(function(){
                    var goods_id = $(this).data("goods_id");
                    if (deviceType == "IOS"){
                        window.webkit.messageHandlers.jsCallOC.postMessage({goods_id:goods_id});
                    }else if(deviceType == "IOS7"){
                        JSManager.goGoodsDetail({goods_id:goods_id});
                    }else if(deviceType == "ANDROID"){
                        JSManager.goGoodsDetail(goods_id);
                    }else{
                        window.location.href = "http://XXXX.com/Category-goodsdetail.html?goods_id="+goods_id;
                    }
                })


    balas
    0
  • Batalbalas