我有一个Firefox OS应用程序,它可以调用跨域页面并下载数据以显示在应用程序上,一切正常,因为我使用了systemXHR权限并在每个XMLHttpRequest上附加了{ mozSystem: true }。
然后我附加了 Flurry 脚本,在应用程序的.js中进行了 FlurryAgent 调用,并在 Firefox OS 模拟器上运行它时开始接收来自 Flurry 事件日志上事件的信息。当我尝试在 Firefox OS 设备上安装我的应用程序时,Flurry 会话永远不会启动,应用程序也永远不会加载。
我不明白为什么 Flurry 在模拟器上而不是在设备上工作。我检查了很多次设备上的互联网连接,这对于浏览器和其他已安装的应用程序运行良好。在我连接Flurry之前,我的应用程序在设备上运行良好。
这是我的代码示例:
.HTML:
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My App</title>
<link rel="stylesheet" href="js/jquery.mobile-1.3.2.min.css" />
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
<link rel="stylesheet" href="css/mystyle.css" />
<script src="https://cdn.flurry.com/js/flurry.js"></script>
<script src="js/app.js"></script>
</head>
<body>
。.js
$(document).on('pagebeforecreate', '[data-role="page"]', function(){
if ($(this).attr('id')=="splash"){
$.mobile.allowCrossDomainPages = true;
}
});
$(document).on('pageinit', '[data-role="page"]', function(){
console && console.log($(this).attr('id') + " - pageinit!!");
if ($(this).attr('id')=="splash"){
FlurryAgent.startSession("7ZFX9Z4CVT66KJBVP7CF"); //Here is were it crashes
alert("Inicio sesion flurry");
console && console.log($(this).attr('id') + "- Entro al if para el timer");
var timer = window.setTimeout(next, 10000);
}
});
如果您还需要帮助我弄清楚会发生什么,请告诉我。我使用的设备是高通型号,特别是Peak,操作系统版本:Boot2Gecko 1.1.1.0hd-GP
这可能是云解决方案提供商的问题。 看看: https://developer.mozilla.org/en-US/Apps/CSP?redirectlocale=en-US&redirectslug=Apps%2FCSP 特别是远程脚本被禁止。