# give/4.15.5/src/DonationForms/resources/app/utilities/getCurrentFormUrlData.js

GiveWP – Donation Plugin and Fundraising Platform, version 4.15.5. 46 lines.

- Page: https://pluginprobe.com/plugins/give/4.15.5/code/src/DonationForms/resources/app/utilities/getCurrentFormUrlData.js
- Raw: https://pluginprobe.com/plugins/give/4.15.5/raw/src/DonationForms/resources/app/utilities/getCurrentFormUrlData.js
- Modified: 2025-02-26T22:53:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.15.5/code/src/DonationForms/resources/app/utilities/getCurrentFormUrlData.js#L10-L20`.

```javascript
/**
 * @since 3.22.0 Add locale support
 */
export default function getCurrentFormUrlData() {
    const originUrl = window.top.location.href;

    const isEmbed = window.frameElement !== null;

    const getEmbedId = () => {
        if (!isEmbed) {
            return null;
        }

        if (window.frameElement.hasAttribute('data-givewp-embed-id')) {
            return window.frameElement.getAttribute('data-givewp-embed-id');
        }

        return window.frameElement.id;
    };

    const getLocale = () => {
        if (!isEmbed) {
            return null;
        }

        if (window.frameElement.hasAttribute('data-form-locale')) {
            return window.frameElement.getAttribute('data-form-locale');
        }

        let locale = '';
        if (window.frameElement.src) {
            const url = new URL(window.frameElement.src);
            locale = url.searchParams.get('locale') || '';
        }

        return locale;
    };

    return {
        originUrl,
        isEmbed,
        embedId: getEmbedId(),
        locale: getLocale(),
    };
}

```
