<!--
{
  "availability" : [
    "macOS: 10.3.0 - 10.14.0"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebHistory/optionalShared()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WebHistory(cm)optionalSharedHistory"
  },
  "title" : "optionalShared()"
}
-->

# optionalShared()

Returns a shared web history object, if one exists.

```
class func optionalShared() -> WebHistory!
```

## Return Value

A shared web history object initialized with the default web history file, or `nil` if one was not previously specified using the [`setOptionalShared(_:)`](/documentation/WebKit/WebHistory/setOptionalShared(_:)) method.

## See Also

[`func load(from: URL!) throws`](/documentation/WebKit/WebHistory/load(from:))

Loads the contents of the specified web history file.

  [WebKit Objective-C Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DisplayWebContent/DisplayWebContent.html#//apple_ref/doc/uid/10000164i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)