Redirect based on Referrer?

  • Hi,


    My client has requested a specific CRM to be used on a Perch Runway website, the integration is typical - embed a form (iframe) submissions go directly into the CRM, Perch Forms is not being used.


    However the form embed uses cookies, which is a problem in Safari. As Safari does not allow an iframe to set cookies unless a cookie has been set previously in a visit to the domain that is trying to set the cookie.


    The developers of the CRM have created a neat workaround to this Safari only issue.


    They detect Safari, detect the lack of a cookie, redirect back to their website (where the form code is hosted) then redirect back to the website hosting the form. All this happens in the blink of an eye.


    This works in their test environments, but not on the Perch powered website.


    I contacted the developer and they told me:


    "All the page does is set a cookie and then 'redirect to the referrer'. It seems it is getting the referrer preview.website.org/ rather than preview.website.org/services - this might be because of client-side routing or similar on your website perhaps?"



    So to recap, the form is on preview.website.org/services, the script bounces the request to the CRM servers, the script redirects to the referrer which should be https://preview.website.org/services but it thinks the referrer is preview.website.org/ so it's not working?


    Anyone got any ideas what's going on here? :/