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

# mainDocumentURL

The main document URL associated with the request.

## Declaration

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

## Discussion

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

## See Also

### Related Documentation

- [mainDocumentURL](foundation/nsmutableurlrequest/maindocumenturl.md)

### Accessing request components

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