The following script is working fine on android studio without problem. However, the router is not working on xcode on mac osx.
Library:
Framework7 @6.0.22
Cordova [email protected]
app.js
var mainView = app.views.create('.view-main', {
url: '/',
});
$$(document).on('deviceready', function() {
mainView.router.navigate('/somewhere/');
app.dialog.alert('Hello2');
});
routes.js
var routes = [
{
path '/',
url: './index.html',
},
{
path: '(.*)',
url: './pages/404.html',
},
];
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
Customize this policy to fit your own app's needs. For more guidance, see:
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
Some notes:
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
* Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
* Enable inline JS: add 'unsafe-inline' to default-src
-->
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="theme-color" content="#007aff">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<title>ForeERP</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="assets/icons/apple-touch-icon.png">
<link rel="icon" href="assets/icons/favicon.png">
<link rel="stylesheet" href="framework7/framework7-bundle.min.css">
<link rel="stylesheet" href="css/icons.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<div id="app">
<!-- Your main view, should have "view-main" class -->
<div class="view view-main view-init safe-areas">
<div class="page" data-name="home">
<!-- Top Navbar -->
<div class="navbar navbar-large">
<div class="navbar-bg"></div>
<div class="navbar-inner sliding">
<div class="title">ForeERP</div>
<div class="title-large">
<div class="title-large-text">ForeERP</div>
</div>
</div>
</div>
<!-- Toolbar-->
<div class="toolbar toolbar-bottom">
<div class="toolbar-inner">
<a href="#" class="link">Left Link</a>
<a href="#" class="link">Right Link</a>
</div>
</div>
<!-- Scrollable page content-->
<div class="page-content">
<div class="block block-strong">
<p>Here is your blank Framework7 app. Let's see what we have here.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Cordova library -->
<script src="cordova.js"></script>
<!-- Framework7 library -->
<script src="framework7/framework7-bundle.min.js"></script>
<!-- App routes -->
<script src="js/routes.js"></script>
<!-- App store -->
<script src="js/store.js"></script>
<!-- App scripts -->
<script src="js/app.js"></script>
</body>
</html>
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="hk.com.foresys.fore.all" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ForeERP</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<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:*" />
<preference name="FadeSplashScreen" value="false" />
<preference name="FadeSplashScreenDuration" value="0" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="AllowNewWindows" value="true" />
</platform>
</widget>
The above screenshot, left side is android studio normally redirect to “Not found” page. But right side is xcode cannot redirect to “Not found” page.