Instance Property

allowsLinkPreview

A Boolean value that determines whether pressing on a link displays a preview of the destination for the link.

Declaration

@property(nonatomic) BOOL allowsLinkPreview;

Discussion

In iOS this property is available on devices that support 3D Touch. In iOS 10 and later, the default value is YES; before that, the default value is NO.

If you set this property’s value to YES, an iOS user can press links to preview link destinations and detected data such as addresses and phone numbers. Such previews are known to users as peeks. If a user presses deeper on a link preview, the preview navigates (or pops, in user terminology) to the destination. Because pop navigation switches the user from your app to Safari, it is opt-in for iOS apps.

If you want to support link preview in iOS but also want to keep users within your app, you can switch from using the WKWebView class to the SFSafariViewController class. If you are using a web view as an in-app browser, making this change is best practice. The Safari view controller class automatically supports link previews.

In macOS this property is available on devices with a Force Touch trackpad. Default value is YES in macOS.

With this property set to its default value of YES, a macOS user can force click a link to display a preview window showing the link’s destination. If the user then clicks on the preview, the destination opens in Safari.

On both platforms, all types of detected data respond to presses when this property is set to YES. That is, in iOS 9 and OS X v10.11, you cannot specify which types of data are detected in the WKWebView class.

See Also

Navigating

allowsBackForwardNavigationGestures

A Boolean value indicating whether horizontal swipe gestures will trigger back-forward list navigations.

backForwardList

The web view's back-forward list.

canGoBack

A Boolean value indicating whether there is a back item in the back-forward list that can be navigated to.

canGoForward

A Boolean value indicating whether there is a forward item in the back-forward list that can be navigated to.

- goBack

Navigates to the back item in the back-forward list.

- goBack:

Navigates to the back item in the back-forward list.

- goForward

Navigates to the forward item in the back-forward list.

- goForward:

Navigates to the forward item in the back-forward list.

- goToBackForwardListItem:

Navigates to an item from the back-forward list and sets it as the current item.

- loadRequest:

Navigates to a requested URL.