1***@qq.com
1***@qq.com
  • 发布:2022-05-26 11:23
  • 更新:2022-05-26 13:43
  • 阅读:377

APP端 plus.navigator.setUserAgent 导致webview白屏

分类:uni-app

<template>
<!--web-view-->
<div class="page">
<web-view :src="url"></web-view>
</div>
</template>

onLoad: function (e) {
// #ifdef APP-PLUS
this.url = e.url;

    //设置webview的UA  
    plus.navigator.setUserAgent("yiuxiu_uniappAndroid_");  
// #endif  

}

然后APP端的webview就白屏了。需要设置UA的时候用setTimeout延迟下,我看别的帖子说是JS阻塞了,但是这样的话貌似webview里面的页面就拿不到设置的UA了

用的是cli 创建的项目。编译器版本是3.4.7

2022-05-26 11:23 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

最终方案 通过manifest.json设置UA

  • 大帅锅

    你好,我这边是动态生成的,有办法设置不?manifest.json只能固定的,我是要动态设置,需要怎么弄呢?

    2022-09-29 11:28

要回复问题请先登录注册