Comments (9)
Ok, I have the page loading without an iframe (NB: the camera plugin won't fire as I had to use CDM to communicate from the iframe to Cordova) but I'm getting this error in the logs:
exeption nativeEvalAndFetch : ReferenceError: Can't find variable: cordova
So far I've tried location.href = "http://localhost:5000";
and location.replace("http://localhost:5000");
methods. Might try the window.open in _self method next...
Related posts:
http://stackoverflow.com/questions/22798792/load-external-page-on-to-cordova-phonegap-application
http://stackoverflow.com/questions/14818138/loading-remote-html-in-phonegap-or-cleaver-cordova-on-ios
from postcardapp.
I think I know what is going on here.. The index page has Cordova referenced with a relative link like this:
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
When you serve your the page from http://localhost:5000
that page should also have Cordova referenced. The issue here is that a simple relative link doesn't work anymore. You could host the right cordova.js
file within the express app, but even that wouldn't solve the issue entirely due to the way Cordova downloads the other files it needs.
from postcardapp.
I've been trying this as a workaround but it seems like I can't get it to work.
Now I have a problem with building again...
from postcardapp.
The exeption nativeEvalAndFetch : ReferenceError: Can't find variable: cordova
error only seems to happen on iOS simulator.
Now the Postcard app works without an iframe, but side effect is losing Cordova.
It's proving difficult to load cordova.js
from Express app ... Tried the following:
- location.href redirect
The problem here is that the 'cordova.js' scripts are stored in the application bundle / assets dir and this dir (cordova.file.applicationDirectory) can't seem to be served by Express app.
eg.Not allowed to load local resource: file:///android_asset/www/cordova.js
- window.open into _self (using cordova-plugin-inappbrowser)
Related articles:
http://www.telerik.com/blogs/cross-window-communication-with-cordova's-inappbrowser
^ No API for communication between windows, but there maybe a workaround... - xhr to load express app into body, I believe this maintains access to cordova.js, but then the app's own scripts don't execute naturally.
from postcardapp.
This does work however -
4. Manually copy the cordova.js
, cordova_plugins.js
, plugins
and cordova-js-src
folder from the 'platforms' build dir into the Express app's public/ dir
The problem with this is getting the build script to hook in nicely - essentially you will need to build the first to get these files generated, the copy them into the public dir and issue a cordova build
after that...
from postcardapp.
Another possible option -
5. Hosted web app plugin... While inappbrowser prevents access to cordova functions, there is a plugin for hosted webapps to allow use of cordova functions! https://github.com/manifoldjs/ManifoldCordova
cordova plugin add cordova-plugin-hostedwebapp --save
The only thing is we need to start url to be dynamic and this sounds like it uses a static manifest.json config with "start_url"...
from postcardapp.
Option 4 seems to work best for what we need - I have this working in a Cordova/JXCore POC using a gulp script with 'after_prepare' hook.
from postcardapp.
Final todo here is to rewire Camera to use normal Cordova function instead of using the iframe's Cross-domain Messaging method.
from postcardapp.
There is also a local websever plugin that might be worth looking at for this purpose but its for iOS only.
https://github.com/apache/cordova-plugins/tree/master/local-webserver
from postcardapp.
Related Issues (20)
- Make change username a modal HOT 2
- Enable autofocus input
- Revert to stable Cordova plugins HOT 4
- URL safe device identity uses dash delimiter HOT 1
- Me record for peer exchange
- Live development reload
- Build on Android only showing Postcard Logo HOT 11
- Story_001_dadougla build failed HOT 4
- Scanning for nearby devices doesn't seem to work. HOT 1
- Update gulp hook script to bundle Cordova plugins with jxcore express app
- Check postcard app with Cordova 6 HOT 5
- Appium capabilities config HOT 1
- Add sync tests to E2E appium tests HOT 3
- Cordova working with localhost HOT 1
- Fix Appium tests with iOS HOT 7
- WKWebView update for iOS HOT 4
- Disable syncing card changes before login
- Architecture of Thali based applications HOT 3
- Fix packages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcardapp.