Is it possible to preserve the state of the UIWebView (e.g the current webpage, back/front list) in the current app launch? For example, if I dealloc a webview, and at some point in the future, I want to recreate it - is it possible to give it the prior state?
iOS preserve state of UIWebView?
2.1k Views Asked by Alex1987 At
2
There are 2 best solutions below
1
nemesis
On
You could try caching the web page, this should get you started. Also, you could try and save the HTML string of the webpage and then use loadHTMLString:baseURL: method of the UIWebView class.
Or you could try and give it a shot with passing the NSURLRequestReturnCacheDataElseLoad as the cache policy of your NSURLRequest, which should cache the data loaded and try to use it whenever it will be requested again.
Good luck!
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in IPHONE
- UIWebView Screen Fitting Issue
- ios responsive design not working (too wide in portrait orientation)
- Setting View orientation to portrait is ignored
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- What is the limit for number of subscribers to a stream(publisher's) in opentok/tokbox iOS SDK?
- How to generate request format for WCF web service method for Mac and iPhone
- Difference between gethostname() and [NSProcessInfo hostName]?
- How to force close ipad/iphone keypad when input element is not focused using JS?
- iOS app rejected because of in-app purchase
- iOS coordinates for iPad and iPhone game using spritekit
- What is the best practice when making a storyboard for iPhone and iPad?
- Labels properties changing in Xcode
- Terminating app due to uncaught exception
- Exchange plist data between 2 iPad using iCloud
Related Questions in IPAD
- Setting View orientation to portrait is ignored
- How to force close ipad/iphone keypad when input element is not focused using JS?
- UIDocumentInteractionController presentation style
- iOS coordinates for iPad and iPhone game using spritekit
- What is the best practice when making a storyboard for iPhone and iPad?
- Exchange plist data between 2 iPad using iCloud
- an app supporting arm64 and armv7 running on arm64 and ios 7 ipad air
- My SIOSocket get disconneted automatically when i locked my ipad
- using livestream video in iOS application
- Always shown vertical and horizontal scroll indicator on a uiwebview
- Is it possible to opt your iPad app out of multitasking on iOS 9
- Bind html button click with objective c
- iPhone App won't run on ipad at 2x resolution
- Missing icon and storyboard files, iOS 7 and 8, Xcode 6
- iOS infinitely deeply nested TableView/UIGestureRecognizer view tree AND iPAD requires 2 finger scrolling on a tableview
Related Questions in UIWEBVIEW
- UIWebView Screen Fitting Issue
- How to hide "Now playing url" in control center
- Cannot select individual words with fixed layout .epub documents
- UIWebView not loading URL in simulator
- Optimize HTML5 for UIWebView
- Use local resources in WKWebview
- UIWebView Image Upload reloading webview Objective c
- How to implement delegate for open source browser SVWebViewController?
- getSelection() don't work in UIWebView iframe
- Customizing Mapbox Callout with HTML on iOS
- Getting return value from JavaScript in UIWebView
- calculating UIWebView height with images gives wrong answer
- EXC_BAD_ACCESS when performing a segue to ViewController with a UIWebView?
- How can I show Google Maps into a WebView?
- Image inside html in UIWebview not fit properly
Related Questions in UIKIT-STATE-PRESERVATION
- Why can't I encode an NSValue in an NSKeyedArchiver?
- How can viewControllerWithRestorationIdentifierPath:coder: find an existing instance?
- iOS preserve state of UIWebView?
- State Preservation for View Controllers with Custom Delegates or Data Sources
- Application state preservation and restoration without using storyboard?
- What is the best way to restore the state of ViewController
- State restoration and preservation , encoding UILabel
- iOS State Preservation in XCode 6
- What are good ways to work around the encoding limitation of SKAction code blocks during application state preservation?
- Xcode : Storyboard and state preservation of the view controllers after quitting
- why my iOS app restarts from first screen after coming back to foreground mode?
- State preservation and restoration strategies with Core Data objects in a UIManagedDocument
- Restore and preserve UIViewController pushed from UINavigationController, no storyboard
- UIViewControllers being created but not shown in state restoration
- Why isn't my navigation stack being preserved upon restoring the app?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Good Approach
In iOS 6 and later, if you assign a value to this view’s restorationIdentifier property, it attempts to preserve its URL history, the scaling and scrolling positions for each page, and information about which page is currently being viewed. During restoration, the view restores these values so that the web content appears just as it did before. For more information about how state preservation and restoration works, see iOS App Programming Guide.