How to save webpage from UIWebview for Offline Browsing - ios

Does anyone have idea, how to download HTML page from UIWebview along with the resources - for offline storage, so user will be able to access web page, even when there is no internet.
It should be achieved without ASIWebPageRequest, since ASIWebPageRequestdownloads a webpage directly from URL. I need to save webpage directly from UIWebview, so that values of radio buttons, textfields etc input by user can be preserved, and load it in the same state later.
Actually, I am displaying surveys webpage offline. If user downloads a webpage after filling some information, it has to be saved in that state. When user opens app later, he should find webpage in the state he left off last time.
Any suggestions are welcome. Please note that this Question is not about caching webpage. It has to be saved in directory. Thanks.

Related

How to know if a user already opened a URL in his browser in past?

I'm building a URL shorten type monetization model in my app. So, I want to know the genuine traffic of the specific URL.
I want to know if the user has already opened the URL in that browser previously.
Here is an app superShare in the play store that does the same thing. It also doesn't record the view as a new user even we open its links in Incognito tabs.
Is there any way to achieve this type of functionality..?

Save display state of WKWebView

I want to be able to save the state of a WKWebView when a user quits out of my app and be able to restore it to exactly how it was when the user returns to the app. I want it to restore websites with forms, online calculators that store the history of calculations, or any websites that make Javascript objects dynamically. How can I do this?
I have tried the createWebArchiveData method here but when saving and restore a web archive version it doesn’t put the display data back exactly how it was. When I restore it from a web archive it is like I just refreshed the page which is not what I want.
I am not able to use any of the HTML5 storage methods or use any evaluateJavaScript methods to handle this since I want to be able to save and restore the state for any website I visit.

Is it possible for a user to download PDF content displayed on WkWebView

We're building an iOS app that displays PDF contents on WkWebView. PDF contents are only for paid users so we do not want users to download those PDF contents(so they are not spread on internet).
I am wondering if such a thing as downloading PDF contents displayed on WkWebView is possible. I could not find any info saying it is possible but cannot find any info saying it it NOT possible.
I need solid proof that a user downloading PDF contents from WkWebView is not possible.
WKWebView doesn't expose any methods for accessing the content contained in the WKWebView. (Usually the issue developers have is trying to allow users to download content from WKWebViews.)
You can implement Certificate Pinning to prevent someone from using a proxy to intercept the files in-transit.
However, there doesn't seem to be a way to prevent someone from taking a screenshot of the WKWebView. There are libraries (such as ScreenShieldKit) for preventing UI from being captured, but these rely on using special UI components that probably won't work with WKWebView.

"Add to Home Screen", save state without app cache?

I have a web site that I'd like users to be able to add to their home screen. Users will switch between this saved "web app" and a game frequently.
The first problem is that when a user comes back to the saved "web app", it displays the splash screen every time even though it wasn't closed. This is undesirable. Further, when a users clicks on a primary navigation element, it switches the user over to Safari.
How do I get the app to "save state" and not re-load the app when coming back to it (when it hasn't been closed)? How do I get it to load links clicked within the same domain to load within the saved "app" rather than loading them up in Safari?
Safari doesn't reload a page when you switch away from the app and come back, so why does a web site saved to the home screen have to reload when pulled to the front?
I don't want to use an offline database, I don't even need the app to work while offline because it needs to tie to a live database that's constantly changing. Therefore a working offline isn't intuitive because the data would be outdated and irrelevant. Therefore, I don't need cacheing either (except maybe a few resources that don't change often). I just want the darn thing to "save state" and not reload every time the user comes back to it. And links clicked within it, shouldn't take the user out of it unless they are links to a different domain.
I've searched and read and searched and read, but I'm not finding anything other than articles about making a web app work offline. That's not my goal. My goal is to make it behave like Safari does in that if it's not explicitly closed, it keeps it's state.

launching an itune music link in app browser NOT the itunes app~

hi my app has links to an itunes music album
like this
http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4
when they click the link in my app, i want to open it in my app (i have a uiwebview), problem is that it launches the uiwebview in my app, but the page is blank, the address bar is also blank, i.e. it doesn't contain the address http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4
i think it is because it is trying to launch the itunes app in the simulator/device
but i don't care, i want the http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4 to load in the browser and display the content like you would in the desktop browser.
please help thanks
As I got from your question, you need to display the album data in your app. For doing that I suggest you two ways.
First solution is to use NSURLRequest with the url and download it's data and load the html in the webview. (you may change the User-Agent too if you wanted to get the desktop version of the page.
The second one is using iTunes API to get album data from iTunes Store as JSON and then display the data in your custom view.
You can get more information on iTunes Store API here
Hope it helps. :)

Resources