mirror of
https://github.com/screego/server.git
synced 2026-11-05 00:01:55 +08:00
6 lines
352 B
TypeScript
6 lines
352 B
TypeScript
const {port, hostname, protocol, pathname} = window.location;
|
|
const slashes = protocol.concat('//');
|
|
const path = pathname.endsWith('/') ? pathname : pathname.substring(0, pathname.lastIndexOf('/'));
|
|
const url = slashes.concat(port ? hostname.concat(':', port) : hostname) + path;
|
|
export const urlWithSlash = url.endsWith('/') ? url : url.concat('/');
|