Can I start a webview out of view, scrape the html, and post forms through it? - html

I'm attempting to develop an application that scapes html of a site for relevant data and then display it back to the user in a more UI friendly way. I'm assuming that you can start a webView by
mWebView = (WebView) findViewById(R.id.webview);
but never setting the content to the actual view. So now my question is, can I take the html from the webview, scrape it, then somehow have the webview post back the forms, all while staying in the background? Any help is appreciated.
Or does anyone know of source such as htmlunit that will compile within android?

I have found out how to extract the HTML from the WebView using JavaScript thanks the guide on this site http://lexandera.com/category/webview_examples/ but I am still searching on how to return post forms to webView. Perhaps through javascript aswell?

Related

Is there a way to access the HTML of an In App Browser (Themeable Browser)

I am using the ionic framework and would like to be able to read from the HTML from the current webpage and then send the selection back to my application.
I have the Theme-able Browser Plugin setup and can use it like any other web browser.
I have tried looking at ways to include my own script with the .executeScript() function but no luck.
I have also tried to read data from custom buttons that I have inserted into the tool/nav bar but that gives me the HTML of my application.
TL;DR: (Basically want access to the DOM of the current webpage and have the user use native selection to read the document.getSelection() and send that text back to my application.)
Any help would be highly appreciated.
After browsing the forums on Ionic I found the solution:
browser.executeScript({code:'window.getSelection().toString();'}).then((selection)=>{
packet.text = selection[0];});
This allows me to get the selection.

How interpret HTML in IOS app using swift

I'm trying to implement my first iphone app but I'm kind a stuck. I have API which return as one of the JSON's response items HTML content (tags like p, img, em, a etc).
What is the best way to interpret HTML content on IOS? I have found basically two possible solutions:
1) UIWebView
I have try this and all content is easily loaded. But am not sure if its good way? I guess that every time user open this view all images (<img src="">) are loaded from internet (I have no control about downloading and caching images?)? Am also not sure how to style elements in webView?
2) UILabel / UITextView
I have tried this also and i can easily remove all html tags but i have no idea how to style text originally wrapped in html tags? I guess that I would have parse complete html a render it manually?
I would be really glad for every advice because I'm not sure what is the right way to continue.
Thank you.
Look up String manipulation in Swift. It's a very basic way of managing web content but it will give you great control. However i really don't recommend using an API that return html response because "Parsing" it will be very resource(CPU,RAM) consuming. Try an API with JSON response. Also if you want to cache. look up kingfisher framework.it's really efficient!
After some research I think that the right way is to use UIWebView. Because UILabel can interpret only basic HTML markup and I get more complicated HTML code like youtube embeds etc.
You can load easily HTML string using UIWebView's method loadHTMLString.
HTML content can be styled using local css. You can get path to local css file using:
NSBundle.mainBundle().URLForResource("myCssFile", withExtension: "css")
If you have local path to css you can add it to html header as usual.
If anybody know better way how to do this i still would be glad for any ideas.

How to Communicate between Qt and a HTML page in QTWidget Application

I am trying to find a way to connect a button in HTML to an action in my C++/Qt application. I loaded a HTML file in QT app using QTextBrowser object. If I click a button in this HTML file, the Qt application should respond. I also might want to implement it vice versa: so that an action in the Qt application would cause a response in the HTML page. Please suggest a suitable solution.
My sample code is :
QWebView view;
view.setStyleSheet(
"background-color:rgb(150,147,88); padding: 7px ; color:rgb(255,255,255)");
view.load(QUrl("test.html"));
view.show();
is there any mechanism like signal/slot ??
There are a few ways to do this, as your sample is working with QWebView rather than QTextBrowser, I'll assume your working with the QWebView.
For page to application QWebView::linkClicked(const QUrl& url) signal is fired when a link is clicked, and QWebView::load(const QUrl& url) will change the page.
If you are creating a JavaScript application, have a look at the QtWebKit Bridge documentation. This allows two way communication with JavaScript running on a page.

Safari Extension : retrieve full HTML code from a page

i'm trying to create a safari extension and i'm stuck with something.
I have my global.html on my extension and i've been searching the web for like 3hours on how to retrieve the full html code without success.
I tried:
document.getElementsByTagName('html')[0].innerHTML (when i alert i only see the code that i have inside my global.html)
document.documentElement.innerHTML (nothing happens)
etc...
I used safari.application.activeBrowserWindow.activeTab.url to retrieve the url but i cant get the html code.
Any help?
Thank you
You can't get the HTML of a web page from your extension's global page. You have to use an injected script and then, if you want, you can pass the web page's HTML to your global page using safari.self.tab.dispatchMessage. See this chapter in Apple's documentation.

Failed to Load swf on a facebook iframe application

I'm currently learning how to make facebook apps, and I've hit a problem.
Usually when I make flash applications, I can use the index.html and run the swf from a webserver.
However, I tried to make a facebook iFrame app using the same setup, all I get is the Alternative Content Text.
Any experienced flash/facebook developer help would be greatly appreciated by this newbie.
Below is what happen to my tutorial app.
http://apps.facebook.com/jeffcheetest/
Do you have filled the field "App Namespace" in the Developer Application Settings? I think it could be the problem...
Are you using FBML? If so, it may be easier to switch to iframe in order to have the swf work in the .html page as you expect it to work. Otherwise, you will need to implement your swf through fbml tags or fbjs code.