mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 22:19:25 +08:00
* refactor: rename 'useURLAndParamsSchema' to 'useURLAndHTMLSchema' and improve it * feat: add 'Open in new window' option * test: add e2e test
26 lines
564 B
TypeScript
26 lines
564 B
TypeScript
/**
|
||
* This file is part of the NocoBase (R) project.
|
||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||
* Authors: NocoBase Team.
|
||
*
|
||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||
*/
|
||
|
||
/**
|
||
* 是否是完整的 URL(带协议的)
|
||
* @param string
|
||
* @returns
|
||
*/
|
||
export function isURL(string) {
|
||
let url: URL;
|
||
|
||
try {
|
||
url = new URL(string);
|
||
} catch (e) {
|
||
return false;
|
||
}
|
||
|
||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||
}
|