How to capture parent URL of page where iframe with form resides

By: Lawrence Smit | Asked: 07/19/2023
ForumsCategory: How-toHow to capture parent URL of page where iframe with form resides
Lawrence Smit asked 1 year ago
Hello I have a form (accept data inputs) and view (show processed results) running side-by-side on a domain, e.g  domain1. It is a fairly complex setup that involves API calls, an automation, etc. I need to embed this page (form+view) into several different websites, e.g. domain2, domain3... domain10. I'm using Advanced iFrame to accomplish this and it works perfectly. What I need however is to capture the parent URL (browser page url) where the iframe resides so I know which site the submission came from. The two code snippets attached apparently capture the parent URL but I'm not sure how to implement either and then capture the results to a field as part of the submission. Any suggestions are appreciated. Kind regards
Lawrence
Attachments
Rob LeVineRob LeVine replied 1 year ago

It depends on how well-versed you are with jQuery. In general, you create a hidden field in your form and then use jQuery to write the URL value into the field so it's saved with the rest of the fields.

Rob LeVineRob LeVine replied 1 year ago

On second thought, can you try making a hidden field and setting its default value to [server param=REQUEST_URI], though I'm not sure how that'll work with the iframe?

Lawrence Smit replied 1 year ago

Thank you for the quick response Rob. I understand what you are suggesting but I'm not familiar enough with jQuery to accomplish this without spending time on it and/or experimenting. I don't mind paying to get this piece of work done.

Please advise.

Lawrence Smit replied 1 year ago

I use [server param=REQUEST_URI] already to capture the URL for different functionality. This returns the iframe URL and not the parent page url.

Rob LeVineRob LeVine replied 1 year ago

Try my second suggestion and if it doesn't work, you can send me an email at [email protected] and we can discuss.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right