We are developing app for Android and iOS for displaying data from server via API (Data is html). But when set data for webview to be displayed, on Android and iOS has difference.
Suppose web has 3 responses with 3 html(with difference html, css (font size, font name)). But on iOS, font size is same for 3 html, on Android, its has difference between 3 html. I have saved html content to file and open by chrome on windows and iOS. The result on Windows like Android and on Mac like iOS.
I dont know what but I think that has a difference between apples's OS with other OSs.
Anyone know why? Please explain me. Many thanks.
Sorry I can't post html contents to here.
Related
My app parses PC html pages and renders them based on native UI components. Currently I'm working on Android, and use Jsoup to extract data from html.
But now I wish to port my app to iOS, WindowsPhone and other platforms.
So I came to this idea, parsing html with the specified platform's WebView. I googled the use case but find nothing.
I wanna try to implement it as below,
download html, load it into a WebView.
inject zepto.js and my own parse.js into the WebView to traverse DOM and find the data I need.
pass the parsed data to native method to render the native view.
The key issue is how can I prevent WebView to render the raw html to improve performance. I wish WebView to parse DOM and run javascript silently, ignore all CSS, do not paint at all (GUI-Less).
How can I achieve this?
Or is it worthy to parse html using WebView instead of Jsoup?
It is not possible to prevent a WebView from rendering Html. A WebView is a View, it has no GUI-less mode.
To ignore css just don't provide a base url, then it won't find the css files (inline will still be there though).
For what you want to do a WebView is not the correct tool.
I'm developing a cross platform mobile app with Qt 5.3.1. I need to load various HTML pages and parse DOM element values from them. At the moment I have succesfully loaded a page with QNetworkAccessManager and stored it in QByteArray but I hit the wall trying to parse the valuable data out from it.
Couple points:
I can't use QWebkit since it's not supported on Android on Qt 5
The HTML can't be assumed being strict mark up, eg Qt's XML readers or DOM parsers won't work on their own
I'm only parsing text from pages. The information is all i need, not visual style
What options do I have? It sounds a little bit stupid that WebKit would be the only way doing this, since I don't need to display any graphical data from webpages. Is writing my own DOM parser for HTML the way to go?
http://qt-project.org/wiki/Handling_HTML
Has a pretty good list of html parsers that are available.
Sometimes a good regular expression can catch what you need, but it isn't as robust as a good HTML parser.
The first link on the page looks pretty promising:
http://tidy.sourceforge.net/libintro.html
I don't know how difficult it would be to build the libraries for Qt Android, but it looks do-able, and works with standard tools.
Hope that helps.
Let's say I have an HTML page which has CSS bound, all parsed from JSON data; is there a way to reproduce exactly ( with responsivity as well ) the same visualization in an android application with no webview ?
My goal is to have a html product that I can see also on an application, but with native elements.
EDIT
maybe this semplifies the situation: how to share HTML between mobile and web?
textview.setText(Html.fromHtml(HTML_STRING));
My android app loads into a webview a web application in a unique html.
My css is huge like 350kb. Sometimes in slow connections(mainly EDGE) not all the styles seems to load correct.
Some images (I am using data uris) are missing and some parts simply doesn't load the css styles.
I've tried to put the style inline in page (supposing that the css file got errors) but with no effect.
It seems like the android webview just stops the css parsing and shows the page.
Has anybody experienced something like this? How could I fix this in a nice way?
I have tested in Gingerbread only.
I think using of mobile app web-based is to be more lighter then the desktop equivalent, because of slower connection of this devices. Have you try to separate the css to see if this issue is because of big loading?
I have a WebView with some web page in it. Now I want to retrieve complete HTML contents of what is inside the WebView.
I use loadUrl("javascript:...") and WebView's javascript interface feature to retrieve this HTML using something like this:
document.getElementsByTagName('html')[0].innerHTML / outerHTML
document.documentElement.outerHTML
...
In each case I receive partial HTML contents - exactly first 10000 characters! So my question is - how do I get complete HTML content? Is it device-specific and, maybe there are workarounds?
Btw, web pages are created dynamically with javascript - I can't simply download the file from server.
Also, I tried printing HTML contents in javascript with console.log and found exactly the same behavior.
Thanks in advance!
My mistake - it was not related to javascript, neither had to do with specific device I tested on.
So, in short, any of those js properties work correctly.