---
title: "isAbsoluteUrl"
description: "检查字符串是否为绝对 URL（含协议前缀），可用于区分相对路径和完整 URL。"
seo_title: "isAbsoluteUrl"
seo_description: "Check whether a URL is absolute, including protocol-relative URLs, so you can decide when to resolve it against a base location."
canonical_url: "https://core.mhaibaraai.cn/docs/utilities/url/is-absolute-url"
---
# isAbsoluteUrl

> 检查字符串是否为绝对 URL（含协议前缀），可用于区分相对路径和完整 URL。

## 用法

`isAbsoluteUrl` 函数用于检查 URL 是否为绝对路径。

```ts
import { isAbsoluteUrl } from '@movk/core'

isAbsoluteUrl('https://example.com') // true
isAbsoluteUrl('/path/to/page') // false
isAbsoluteUrl('//example.com/path') // true (协议相对)
```

## API

### `isAbsoluteUrl(url)`

检查 URL 是否为绝对路径。

### 参数

**url** (`string`) *required*: 要检查的 URL。

### 返回值

**返回值** (`boolean`): 是否为绝对路径。

## Changelog

See commit history for [src/utilities/url/parse.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/url/parse.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
