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
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in IPHONE
- How to control the volume of an iPhone programmatically in objective-c
- my website crash on safari The site sometimes crashes and I can't recover the crash
- Postal Framework crash in iPhone but runs successfully in simulator
- Xcode 15 building failure when using iphone 15 as simulator, using ios 17
- Images uploaded via Active Storage not displaying in Active Admin or on certain devices
- Any problem with creating provisioning profile with old Iphone?
- Does anyone know how to make iPad layout the same as iPhone's? Size wise the text and overall layout get's smaller when I run the app on the iPad
- Keyboard not appearing when connecting smart card reader to iPhones with type-c port. i.e. iPhone 15/ 15 pro
- Access the list of SIM mobile numbers installed in the iPhone
- Can we produce haptics and record from microphone the haptic sound at the same time on iOS?
- SwiftUI's localized string do not load from main bundle despite using the main bundle identifier (an xcode bug?)
- Cordova iOS only app upload through transport requires WKWatchKitApp
- Amazon s3 video is not played on Iphone
- build getting failed for ios xcode build -flutter app
- "Error when Importing 'mysdk' into iOS Demo App: dyld Library not loaded: @rpath/MQTTClient.framework/MQTTClient"
Related Questions in IPAD
- Site loads on iPad/Chrome but not on iPad/Safari
- Possible to use NFC for iPad
- Intune IpadOS disable Safari quick notes
- Does anyone know how to make iPad layout the same as iPhone's? Size wise the text and overall layout get's smaller when I run the app on the iPad
- How to setup different launch screen image for iPad portrait and landscape mode?
- Appear Circles in ZStack exact image position as navigationSplitView (.balanced) opens or close
- Can I use VS code on Ipad
- Webapp exiting fullscreen when dragging mui slider in iPads
- Why are pointer events disabled when using Apple's pencil in Safari?
- @media print @page margins not working on Mac Safari and iPad
- FontAwesome Icons displays as white on iPad instead of Black as on other platforms making them almost invisible
- SwiftUI .autocorrectionDisabled() behavior not updating with @State BOOL
- SwiftUI Previews Multitasking Options
- Flutter - how to prevent an app being closed by user on IpadPro (iPadOs 17)
- ipadOS 17.4: AVCaptureMetadataOutput delegate not called (qrscanner)
Related Questions in UIWEBVIEW
- iOS WKWebView's WKProcessPool - when is it safe to share the same process space?
- I there a Flutter package that implements UIWebView?
- How to prevent the Audio `play` method from stopping sounds in backgrounded apps in a Webview?
- How to open a downloaded .ics file in Calendar app?
- Where to persistently store cookies from WebView IOS?
- open Webview as full screen tab intellij plugin development
- Apple rejected the project because of using UIWebView in pod
- UserAgent cannot be changed from UserDefaults only iOS 17 Device using Xcode 15
- ITMS-90809: Deprecated API Usage with AppsFlyerFramework pod
- Outlook calendar download in webview not displaying the right time in iOS app
- iOS 17 , when entering Chinese characters, the program crashes. The system is using UIWebView
- Delete all WKWebView and URLSession related cached data
- Convert WKWebView to PDF / Swift
- upgrade UIWebView to WKWebView in Cordova
- Is UIWebView will continue in iOS 17?
Related Questions in UIKIT-STATE-PRESERVATION
- why my iOS app restarts from first screen after coming back to foreground mode?
- Why isn't my navigation stack being preserved upon restoring the app?
- How can I prevent SKAction sequence restarting after decoding?
- What are good ways to work around the encoding limitation of SKAction code blocks during application state preservation?
- State Restoration in Tab Bar and Navigation Controller App
- iOS State Preservation in XCode 6
- UICollectionView state restoration: customizing scroll position
- State preservation and restoration strategies with Core Data objects in a UIManagedDocument
- Restore and preserve UIViewController pushed from UINavigationController, no storyboard
- Xcode : Storyboard and state preservation of the view controllers after quitting
- IOS state preservation: can I display a launch image instead of a snapshot
- When an app is in background, how to determine if an app is closed by a user or by IOS
- State restoration and preservation , encoding UILabel
- State preservation and restoration in ios 7 with xcode 5
- State Preservation and Restoration UIImageView added from button event
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 # Hahtags
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.