---
title: mainDocumentURL
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlrequest/maindocumenturl
---

# mainDocumentURL

The main document URL associated with this request.

## Declaration

```swift
var mainDocumentURL: URL? { get set }
```

## Discussion

Discussion This URL is used for the cookie “same domain as main document” policy.

## See Also

### Accessing request components

- [httpMethod](foundation/urlrequest/httpmethod.md)
- [url](foundation/urlrequest/url.md)
- [httpBody](foundation/urlrequest/httpbody.md)
- [httpBodyStream](foundation/urlrequest/httpbodystream.md)
