function validateUrl()

in src/Popout.tsx [261:281]


function validateUrl(url: string) {
    if (!url) {
        return;
    }

    const parser = document.createElement('a');
    parser.href = url;

    const current = window.location;

    if (
        (parser.hostname && current.hostname != parser.hostname) ||
        (parser.protocol && current.protocol != parser.protocol)
    ) {
        throw new Error(
            `react-popup-component error: cross origin URLs are not supported (window=${
                current.protocol
            }//${current.hostname}; popout=${parser.protocol}//${parser.hostname})`
        );
    }
}