我创建了一个hello world Cordova应用程序,并且我正在尝试加载现有的SPA Web应用程序。这是我的index.html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Winetracker.co</title>
</head>
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script>
function onDeviceReady() {
if (navigator.connection.type == Connection.NONE) {
navigator.notification.alert('An internet connection is required to continue');
} else {
window.location="https://app.winetracker.co";
}
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
</body>
</html>
这是我的config.xml文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="co.winetracker.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Winetracker.co</name>
<description>
The easiest way to keep track of the wine you drink.
</description>
<author email="tony@winetracker.co" href="http://winetracker.co">
Winetracker.co
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="*://*.winetracker.co/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
我已经完成了几个教程并尝试了多种变体(例如只是链接到google.com或者是test.html文件),但我确定我只是遗漏了一些东西。任何新鲜的眼睛都能看到问题吗?
答案 0 :(得分:0)
原来,javascript安全策略存在阻塞问题。
我用以下内容换掉了这一行,它完美地运作了:
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com *; style-src * 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; connect-src *; media-src *">
答案 1 :(得分:0)
Sub Foreign_Lang_Converter()
Sheets("Sheet2").Select
Value = 0
i = 1
Do While (Cells(i, 2) <> "")
Value = Value + 1`enter code here`
i = i + 1
Loop
Count = 0
For j = 1 To Value
a = Cells(j, 1)
b = Cells(j, 2)
Sheets("Sheet1").Select
Cells.Select
Application.ReplaceFormat.Clear
With Application.ReplaceFormat.Font
.Subscript = False
.TintAndShade = 0
End With
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Replace What:=a, Replacement:=b, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True
Sheets("Sheet2").Select
Next j
End Sub
<!DOCTYPE html>