Class WKWebView

All Implemented Interfaces:
CALayerDelegate, NSCoding, NSObjectProtocol, UIAccessibilityIdentification, UIActivityItemsConfigurationProviding, UIAppearanceContainer, UICoordinateSpace, UIDynamicItem, UIFocusEnvironment, UIFocusItem, UIFocusItemContainer, UILargeContentViewerItem, UIPasteConfigurationSupporting, UIResponderStandardEditActions, UITraitEnvironment, UIUserActivityRestoring, ObjCProtocol

public class WKWebView
extends UIView
  • Constructor Details

  • Method Details

    • getConfiguration

      public WKWebViewConfiguration getConfiguration()
    • getNavigationDelegate

      public WKNavigationDelegate getNavigationDelegate()
    • setNavigationDelegate

      public void setNavigationDelegate​(WKNavigationDelegate v)
    • getUIDelegate

      public WKUIDelegate getUIDelegate()
    • setUIDelegate

      public void setUIDelegate​(WKUIDelegate v)
    • getBackForwardList

      public WKBackForwardList getBackForwardList()
    • getTitle

      public String getTitle()
    • getURL

      public NSURL getURL()
    • isLoading

      public boolean isLoading()
    • getEstimatedProgress

      public double getEstimatedProgress()
    • hasOnlySecureContent

      public boolean hasOnlySecureContent()
    • getServerTrust

      public SecTrust getServerTrust()
      Since:
      Available in iOS 10.0 and later.
    • canGoBack

      public boolean canGoBack()
    • canGoForward

      public boolean canGoForward()
    • getCameraCaptureState

      public WKMediaCaptureState getCameraCaptureState()
      Since:
      Available in iOS 15.0 and later.
    • getMicrophoneCaptureState

      public WKMediaCaptureState getMicrophoneCaptureState()
      Since:
      Available in iOS 15.0 and later.
    • allowsBackForwardNavigationGestures

      public boolean allowsBackForwardNavigationGestures()
    • setAllowsBackForwardNavigationGestures

      public void setAllowsBackForwardNavigationGestures​(boolean v)
    • getCustomUserAgent

      public String getCustomUserAgent()
      Since:
      Available in iOS 9.0 and later.
    • setCustomUserAgent

      public void setCustomUserAgent​(String v)
      Since:
      Available in iOS 9.0 and later.
    • allowsLinkPreview

      public boolean allowsLinkPreview()
      Since:
      Available in iOS 9.0 and later.
    • setAllowsLinkPreview

      public void setAllowsLinkPreview​(boolean v)
      Since:
      Available in iOS 9.0 and later.
    • getScrollView

      public UIScrollView getScrollView()
    • getPageZoom

      public double getPageZoom()
      Since:
      Available in iOS 14.0 and later.
    • setPageZoom

      public void setPageZoom​(double v)
      Since:
      Available in iOS 14.0 and later.
    • getMediaType

      public String getMediaType()
      Since:
      Available in iOS 14.0 and later.
    • setMediaType

      public void setMediaType​(String v)
      Since:
      Available in iOS 14.0 and later.
    • getInteractionState

      public NSObject getInteractionState()
      Since:
      Available in iOS 15.0 and later.
    • setInteractionState

      public void setInteractionState​(NSObject v)
      Since:
      Available in iOS 15.0 and later.
    • getThemeColor

      public UIColor getThemeColor()
      Since:
      Available in iOS 15.0 and later.
    • getUnderPageBackgroundColor

      public UIColor getUnderPageBackgroundColor()
      Since:
      Available in iOS 15.0 and later.
    • setUnderPageBackgroundColor

      public void setUnderPageBackgroundColor​(UIColor v)
      Since:
      Available in iOS 15.0 and later.
    • getFullscreenState

      public WKFullscreenState getFullscreenState()
      Since:
      Available in iOS 15.0 and later.
    • getLayerClass

      public static Class<? extends CALayer> getLayerClass()
    • getCertificateChain

      @Deprecated public List<SecCertificate> getCertificateChain()
      Deprecated.
      Deprecated in iOS 10.0. Use serverTrust
      Since:
      Available in iOS 9.0 and later.
    • init

      protected long init​(CGRect frame, WKWebViewConfiguration configuration)
    • init

      protected long init​(NSCoder coder)
      Overrides:
      init in class UIView
    • loadRequest

      public WKNavigation loadRequest​(NSURLRequest request)
    • loadFileURL

      public WKNavigation loadFileURL​(NSURL URL, NSURL readAccessURL)
      Since:
      Available in iOS 9.0 and later.
    • loadHTMLString

      public WKNavigation loadHTMLString​(String string, NSURL baseURL)
    • loadData

      public WKNavigation loadData​(NSData data, String MIMEType, String characterEncodingName, NSURL baseURL)
      Since:
      Available in iOS 9.0 and later.
    • goToBackForwardListItem

      public WKNavigation goToBackForwardListItem​(WKBackForwardListItem item)
    • goBack

      public WKNavigation goBack()
    • goForward

      public WKNavigation goForward()
    • reload

      public WKNavigation reload()
    • reloadFromOrigin

      public WKNavigation reloadFromOrigin()
    • stopLoading

      public void stopLoading()
    • evaluateJavaScript

      public void evaluateJavaScript​(String javaScriptString, VoidBlock2<NSObject,​NSError> completionHandler)
    • evaluateJavaScript

      public void evaluateJavaScript​(String javaScriptString, WKFrameInfo frame, WKContentWorld contentWorld, VoidBlock2<NSObject,​NSError> completionHandler)
      Since:
      Available in iOS 14.0 and later.
    • callAsyncJavaScript

      public void callAsyncJavaScript​(String functionBody, NSDictionary<NSString,​?> arguments, WKFrameInfo frame, WKContentWorld contentWorld, VoidBlock2<NSObject,​NSError> completionHandler)
      Since:
      Available in iOS 14.0 and later.
    • closeAllMediaPresentations

      public void closeAllMediaPresentations​(Runnable completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • closeAllMediaPresentations

      @Deprecated public void closeAllMediaPresentations()
      Deprecated.
      Deprecated in iOS 15.0. Use closeAllMediaPresentationsWithCompletionHandler:
      Since:
      Available in iOS 14.5 and later.
    • pauseAllMediaPlayback

      public void pauseAllMediaPlayback​(Runnable completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • setAllMediaPlaybackSuspended

      public void setAllMediaPlaybackSuspended​(boolean suspended, Runnable completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • resumeAllMediaPlayback

      @Deprecated public void resumeAllMediaPlayback​(Runnable completionHandler)
      Deprecated.
      Deprecated in iOS 15.0. Use setAllMediaPlaybackSuspended:completionHandler:
      Since:
      Available in iOS 14.5 and later.
    • suspendAllMediaPlayback

      @Deprecated public void suspendAllMediaPlayback​(Runnable completionHandler)
      Deprecated.
      Deprecated in iOS 15.0. Use setAllMediaPlaybackSuspended:completionHandler:
      Since:
      Available in iOS 14.5 and later.
    • requestMediaPlaybackState

      public void requestMediaPlaybackState​(VoidBlock1<WKMediaPlaybackState> completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • setCameraCaptureState

      public void setCameraCaptureState​(WKMediaCaptureState state, Runnable completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • setMicrophoneCaptureState

      public void setMicrophoneCaptureState​(WKMediaCaptureState state, Runnable completionHandler)
      Since:
      Available in iOS 15.0 and later.
    • takeSnapshot

      public void takeSnapshot​(WKSnapshotConfiguration snapshotConfiguration, VoidBlock2<UIImage,​NSError> completionHandler)
      Since:
      Available in iOS 11.0 and later.
    • createPDF

      public void createPDF​(WKPDFConfiguration pdfConfiguration, VoidBlock2<NSData,​NSError> completionHandler)
      Since:
      Available in iOS 14.0 and later.
    • createWebArchiveData

      public void createWebArchiveData​(VoidBlock2<NSData,​NSError> completionHandler)
      Since:
      Available in iOS 14.0 and later.
    • findString

      public void findString​(String string, WKFindConfiguration configuration, VoidBlock1<WKFindResult> completionHandler)
      Since:
      Available in iOS 14.0 and later.
    • startDownload

      public void startDownload​(NSURLRequest request, VoidBlock1<WKDownload> completionHandler)
      Since:
      Available in iOS 14.5 and later.
    • resumeDownload

      public void resumeDownload​(NSData resumeData, VoidBlock1<WKDownload> completionHandler)
      Since:
      Available in iOS 14.5 and later.
    • loadSimulatedRequest

      public WKNavigation loadSimulatedRequest​(NSURLRequest request, NSURLResponse response, NSData data)
      Since:
      Available in iOS 15.0 and later.
    • loadFileRequest

      public WKNavigation loadFileRequest​(NSURLRequest request, NSURL readAccessURL)
      Since:
      Available in iOS 15.0 and later.
    • loadSimulatedRequest

      public WKNavigation loadSimulatedRequest​(NSURLRequest request, String string)
      Since:
      Available in iOS 15.0 and later.
    • loadSimulatedReques

      @Deprecated public WKNavigation loadSimulatedReques​(NSURLRequest request, String string)
      Deprecated.
      Deprecated in iOS 15.0. Use loadSimulatedRequest:responseHTMLString:
      Since:
      Available in iOS 15.0 and later.
    • handlesURLScheme

      public static boolean handlesURLScheme​(String urlScheme)
      Since:
      Available in iOS 11.0 and later.
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute attribute)
      Since:
      Available in iOS 9.0 and later.
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute semanticContentAttribute, UIUserInterfaceLayoutDirection layoutDirection)
      Since:
      Available in iOS 10.0 and later.