android - 从科尔多瓦的 playstore 获取应用程序版本
问题描述
我正在尝试将应用程序的应用程序版本上传到 Playstore,我正在尝试将https://play.google.com/store/apps/details?id与此代码一起使用
var url = 'https://play.google.com/store/apps/details?id=' + appID;
$.ajax({
url: your_url,
type: 'GET',
crossDomain:true,
success: function(res) {
let storeVersion =null;
var doc=null;
var tag=null;
var parser = new DOMParser(),
doc = parser.parseFromString(res, 'text/html');
if (doc)
{
tag = doc.querySelectorAll(".hAyfc .htlgb");
if (tag && tag[6]) {
storeVersion = tag[6].innerText.trim();
}
}
});
在模拟器中正常工作,但在物理设备中返回错误 403,我尝试在内容安全策略中添加很多选项
<meta http-equiv="Content-Security-Policy" content="default-src *; img-src * data: https: 'self' 'unsafe-inline' 'unsafe-eval' ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; media-src *; connect-src * data: https: 'self' 'unsafe-inline' 'unsafe-eval' https://play.google.com">
但没有工作,我错过了什么吗?还有其他获取playstore版本的方法吗?
解决方案
请检查config.xml
并确保这些行已经添加。
<allow-navigation href="*" />
<access origin="*" />
您使用的是什么版本的 Cordova 和 Cordova Android?
你已经安装了cordova-plugin-whitelist
吗?
推荐阅读
- powerbi - PowerBI - 困扰我的问题;测量在不同层次结构级别上正确汇总,但使用切片器在表中消失名称
- visual-studio-code - VS Code 终端为空白/不可用
- python - 使用 for 循环将 Pandas 系列转换为 Dataframe
- html - 中心表单输入但不是标签
- r - 优化 R(投资组合)中的权重
- sql - 尝试添加 ROW_NUMBER 时是否可以在此查询中删除级联 CTE
- python - 如何获得 Keras 模型的 F-1 准确率和混淆矩阵?
- java - 每次开始时生成的 JLabels 的数量似乎都是随机的
- javascript - JavaScript 中的关系比较
- mysql - SQL - 数据库是多次还是只提取一次重复的连接数据?