Help: Capture full page URL in hidden field when same Zoho Form is embedded on multiple pages (iframe)

Help: Capture full page URL in hidden field when same Zoho Form is embedded on multiple pages (iframe)

Hi all,

Goal
Use one Zoho Form across multiple pages and record the exact page URL (incl. subdomain + path + hash) where the user submitted it.
Example pages:




I want a hidden field in the form (alias: source_page) to store that full URL on submission.

Current embed (iframe):

<iframe id="zohoForm" aria-label="Contact Us" frameborder="0" style="height:500px;width:100%;border:none;"
</iframe>


What I tried (none of these populated the field):

Added a hidden Single Line field in Zoho with Field Alias = source_page (also tried matching Field Link Name).

After the iframe tag, appended the page URL into the iframe src:

<script>
document.addEventListener('DOMContentLoaded', function () {
  var ifr = document.getElementById('zohoForm');
  if (!ifr) return;
  var u = new URL(ifr.src);
  u.searchParams.set('source_page', window.location.href);
  ifr.src = u.toString();
});
</script>


A “belt-and-suspenders” version that handles data-src/lazy-load, re-applies on load, hashchange, and via MutationObserver (still no value in submissions).

Tried hardcoding a prefilled URL directly in the iframe src (static test), e.g.:
.../formperma/FORMPERMA_ID?source_page=https%3A%2F%2Fwww.example.com%2Fcargo%2F — still not showing in the submission.

Verified browser referrer isn’t reliable (only shows eTLD+1), so I can’t rely on document.referrer.

What I’m asking the community / Zoho team:

Has anyone successfully captured the full embedding page URL in a hidden field when using the iframe embed?

In practice, does Zoho Forms prefill from URL read the Field Alias or the Field Link Name for iframe embeds? Any special toggle needed?

Is there an officially recommended approach (iframe vs. JavaScript embed) for passing dynamic values like the parent page URL into hidden fields?

Are there known caveats with URL fragments (#contact), lazy-loading iframes, or caching/CDN that would block this?

If you’ve gotten this working, could you share your exact steps (field settings + embed method + code)?

Environment details:

Embed type: iframe (not the JavaScript embed)

Hidden field: Single Line, Alias source_page (hidden)

Pages are standard static pages (no SPA), may use lazy-load by the site builder/CDN

Need to support both path and subdomain variations (e.g., https://cargo.example.com/...)

Desired outcome:
Every submission includes a hidden field source_page like:



Thanks in advance I really appreciate any step-by-step examples from folks who have this working.

      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Sticky Posts

          • DKIM Now Mandatory - Changes to Zoho Forms Email Policies

            Hello Zoho Forms Users, This post is to inform you about an important update regarding the authentication of all email domains in your Zoho Forms account. This year, we are doubling down on our commitment to deliver a secure, seamless, and empowering
          • Cloudflare Turnstile is now available in Zoho Forms!

            Hello form builders! We have added a new layer of protection to help you keep your forms free from bots. Instead of forcing users to prove they are human, Cloudflare Turnstile quietly checks browser signals in the background. Your real users glide through,
          • This festive season, offer discounts with coupon code support in Stripe Checkout

            Hello form builders! It’s the festive season, the perfect time to spread joy and great deals! Now, with Zoho Forms’ latest enhancement for Stripe Checkout, you can do exactly that with coupon codes! Your payment forms integrated with Stripe Checkout can
          • New in Zoho Forms: Google reCAPTCHA v3 for smarter spam protection

            Hello form builders, Spam submissions are one of the biggest challenges when you share your forms online. They not only clutter your data but can also waste valuable time. To help you combat this without making life harder for genuine respondents, we’re
          • New in Zoho Forms: Inline OTP Verification

            Hello form builders, We are excited to announce the launch of Inline OTP Verification in Zoho Forms, a smarter way to ensure the authenticity of the contact details you collect. Until now, OTP Verification in Zoho Forms worked as a pre-access step: respondents

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ






                                ご検討中の方