我在Cordova项目的index.html中有以下代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="img-src * 'self' data:; default-src * 'self' gap: wss: ws: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval';">
<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>MyBilli</title>
</head>
<body>
<script type="text/javascript">
document.addEventListener('deviceready', function() {
var url = 'http://sub.domain.com/app/nl/login/' // change to whatever you want
cordova.InAppBrowser.open(url, '_blank', 'location=no,zoom=no');
}, false)
</script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>
当前Cordova插件列表:
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-media 3.0.1 "Media"
cordova-plugin-media-capture 1.4.3 "Capture"
cordova-plugin-network-information 1.3.3 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
是否可以根据用户的操作系统语言(只允许3种语言: en , fr 或 nl )重定向用户不同的网址:sub.domain.com/app/ [en | fr | nl] / login /
如果 en , fr 或 nl 不是用户的操作系统语言,则默认为 zh_
答案 0 :(得分:1)
您似乎可以使用https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-globalization/
获取设备语言然后你必须更换所拾取内容的网址部分