Local AngularJS application hosted in WKWebView - angularjs

I have a hybrid application built using a WKWebView. I have gotten around the loading local files issue, but I am having trouble loading an AngularJS application from local files. I am getting the following error:
Cross origin requests are only supported fro HTTP.
With Android I was able to update setting on the WebView control to allow this from file:// schemes. Is there anything similar that I am missing in iOS? Or another solution?
I am using XCode 6.3 (6D570)

This is a known issue with WKWebView in iOS 8, and I suspect that's why UIWebView remains undeprecated.
I haven't had time to use the betas yet, but my only suggestion is to give the latest Xcode 7/iOS 9 a shot, and use the new WKWebView API
- (WKNavigation * _Nullable)loadFileURL:(NSURL * _Nonnull)URL allowingReadAccessToURL:(NSURL * _Nonnull)readAccessURL
which would ideally let you pull in other HTML files as templates in the readAccessURL that you provide.
Please file any bugs you see in the latest beta. Apple is way too slow to move on the issues in WKWebView.
If you just need the Angular app to work now, then you'll need to switch to UIWebView, which is confirmed to work with angular-based webapps stored on the device.

Related

How to use chromium engine inside google chrome to render my application

I wonder if it is possible to use chromium engine inside google chrome or the google chrome itself to render a web page inside my WPF application instead of using traditional WebView (because it's the IE engine and it's awful -_-) or implementing CEFSharp (because it uses about 200 MB of space only for the chromium engine)
so in this case I need the target pc to has installed google chrome or any other(firefox or ...)
Soooo ... is there any solution?
thanks in advance
EDIT
I want to create applications based on web UI, - because of being easy and powerful - I know some providing this feature, e.g. CEF Sharp WPF or electron js but they include a full chromium engine with the app. I don't want this.
I want to create my app as light as possible, and my idea is to use chromium engine of a modern browser, that almost everyone has one.
For example, imagine that the user has installed google chrome.
first I locate the installation folder
I use chromium.exe -render path/to/file.html(imaginary) command to render my application UI.
finally bind the UI events to my native code. (e.g. c#(wpf) or any language that you can create desktop apps with it)
One solution is creating web apps by installing a website with the browser. but with that you cannot for example create or read some files in user pc, or any similar operation.
I'm looking for the most light-weight solution...
There is a new Chromium based WebView2 control that you can use to embed modern web content in your WPF application.
Please refer to the docs for more information about the prerequisites and how to use it:
Getting started with WebView2 in WPF
Explanation
So, let's say that you want your UI to be rendered in a chromium environment(aka a browser)… right?
let's take a look at electron js:
it uses NodeJS as backend.
it uses an embedded browser for frontend.
the language used is JavaScript due to NodeJS.
So, you want to use the client's browser to render your frontend instead of embedding a browser inside it.
well, don't embed it!!
you can create a web application(e.g. opened by typing localhost:<port> in browser1) using NodeJS and handle your IPC(between frontend and backend) using ajax calls or a socket connection.
that way you are doing exactly what an electron app does, except that, electron uses a bundled browser.
now you made your app lighter, also if your client do have NodeJS installed, you don't need to bundle NodeJS!
--- inspired by jupyter notebooks ---
Possible Solutions
use NodeJS as backend.
use python and combine it with Flask or Django as backend. (I think this would be the most lightweight solution)
use PHP as backend. (the best, personal opinion)
use ASP.NET/Blazor as backend. (as mentioned in the comments; but doesn't seem to be a lightweight solution)
or use any language that you can create a web application with that!
make a runApp.bat or runApp.sh to simply run your server and open the browser automatically.

HtmlEasy and Silken to serve mobile specific page

I'm busy building a web page where I'm using HtmlEasy and Silken with Google Closure Templates.
With ASP.NET MVC4 there is a technique of serving a mobile version of a web page by changing the file name to .mobile.. So it is not just the same version served up using a different stylesheet - the contents/data too can be different. This is really great since not everything may be relevant for a person using a mobile device.
Does HtmlEasy and Silken provide the same or similar feature? I can't seem to find anything that'll help.
Ok, when you need to detect any mobile device then its better to make use of a database.
For my own project I'm using 51Degrees Lite. Pass the user-agent to the lib and it'll tell you if the device is mobile or not. Then serve your soy template(s) accordingly.

es5-shim or chrome frame for making angular apps work in IE

I am developing rich frontend apps which will be used by users running IE 8 and above. I am using angular.js as my frontend framework.
I currently see two choices using es5shim or google chrome frame. What I am not able to discern are the differences between both.
As I understand that es5-shim monkey patches the js engine, and is much more lighter as it doesnt require the user to download and install.
What does chrome frame provide over es5-shim, and which is recommended?
Google Chrome Frame is a application, and need user to install it, es5-shim is JavaScript code, you just need to include it.
If you want to use AngularJS in in IE, you should read this: http://docs.angularjs.org/guide/ie. Long in short, include es5-shim(optional but really useful) and JSON polyfill.

Persistence solution for mobile Phonegap / HTML5 App

I am developing a mobile app for Android and iOS using jQuery Mobile.
The app will be deployed to Android and iOS devices utilizing Phonegap.
My problem is that I need a local offline data storage mostly for read operations.
I am planning to pull a data set from a web server (MySQL/web service) about once a month (whenever there is new data) and store it for local use on the device.
Now the question, what persistence solution should I use?
There is a tool called lawnchair by a member of the Phonegap team. Anyone tried it? What are the pros and cons? http://westcoastlogic.com/lawnchair/
What about sqlite? Is it working across Android and iOS devices?
THX
You could simply use HTML5 Storage / SQL Lite for this. Take a look at: http://diveintohtml5.ep.io/storage.html
I`ve been using Localstorage on iOs and Android without any problems, and since localstorage is backed up by sqllite i think you should be fine. (but i can´t say anything for sure for sqllite on android)
HTML5 storage works fine on Android. A nice tool to make reading and writing to the database easier is persistenceJS.
I've just started on setting up the iPhone version of my jQueryMobile / Phonegap app. It stalls right at the point where the first call to localdb is made. This may be a problem of the iOS simulator, since the regular Safari runs my app just fine from the browser.
The HTML5 LocalStorage option will works fine until iOS 5.0. But there might be some problems from iOS 5.1 and later.
So my suggestion is to write some javascript code to back up to the document folder via fileAPI, and reconstruct the WebSQL database periodically.

coverting existing flash with cakephp website into mobile version

How to convert the existing flash site into mobile version existing site in form of the cakephp frame work. We thought that html ,css,php,javascript may work all mobiles.We dont know exactly. Please tell us how many possible way to develop existing site into mobile version and also need to detect the from which browser the request is coming whether mobile browser or pc browser.
The existing site link is :This site convert into mobile version
Take a look at this post. PHP is handled on the server. No browser needs to support it. CSS and XHTML are supported pretty well by mobile browsers. Javascript support is limited.

Resources