<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WebPage/mediaType",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:6WebKit0A4PageC9mediaTypeAC08CSSMediaE0VSgvp"
  },
  "title" : "mediaType"
}
-->

# mediaType

The media type for the contents of the webpage.

```
@MainActor final var mediaType: WebPage.CSSMediaType? { get set }
```

## Discussion

When the value of this property is `nil`, the webpage derives the current media type from the CSS
media property of its content. If you assign a value other than `nil` to this property, the webpage
uses the value you provide instead.

For example, you can use this property to configure a page for viewing as a print preview by setting
it to [`print`](/documentation/WebKit/WebPage/CSSMediaType/print).

The default value of this property is `nil`.

---

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)