【问题标题】:when i open a url using inappbrowser it doesn't open当我使用 inappbrowser 打开一个 url 时,它没有打开
【发布时间】:2019-03-18 02:21:18
【问题描述】:

当我尝试使用 inappbrowser 在 android 中打开一个 url 时,该 url 没有打开 a 显示一个空白屏幕,该 url 在顶部。但是,当我尝试在 chrome 中打开相同的 url 时,它可以正常打开,并且在 ios 设备上也可以正常工作。 只有在 android inappbrowser 中打开时才会出现问题。 是一些 javscript 问题还是其他问题,我无法弄清楚。 这是打开网址的代码:

常量浏览器 = this.iab.create('loginDetails.serverURL','_blank','location=yes,toolbar=yes');

【问题讨论】:

标签: javascript android cordova ionic-framework cordova-plugins


【解决方案1】:

你可以用这个..

String link=URL_LINK;
if (!link.startsWith("http://") && !link.startsWith("https://")){
      link = "http://" + link;
   }
   Uri uri = Uri.parse(link); // missing 'http://' will cause crashed
   Intent intent = new Intent(Intent.ACTION_VIEW, uri);
   context.startActivity(intent);

【讨论】:

  • 我的链接以“https://”开头,是一个有效链接,因为它正在浏览器和 ios inappbrowser 中打开。所以我认为这不是我的问题
猜你喜欢
  • 2020-08-13
  • 2019-11-24
  • 2021-06-17
  • 2017-10-28
  • 2021-12-29
  • 1970-01-01
  • 2015-08-29
  • 2021-10-11
  • 1970-01-01
相关资源
最近更新 更多