Get the URL of the typeform page to results | Community
Skip to main content
Answered

Get the URL of the typeform page to results


Show first post

38 replies

  • Explorer
  • 2 replies
  • January 14, 2024
jeremielp wrote:

You can create a url_form hidden field in your form, and then pass the URL of the page when loading the form dynamically.

 

<div id="tf"></div>
<link rel="stylesheet" href="//embed.typeform.com/next/css/widget.css" />
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
  window.tf.createWidget('<form-id>', {
    container: document.getElementById('tf'),
    hidden: { url_form: window.location.href }
  });
</script>

 

 

@jeremielp thank you very much, that works. But I would like my form to be embedded in a slider format. My slider view code is:

<div data-tf-live="01HM2CYB1HZV6VWWG3XYTK4K7D"></div><script src="//embed.typeform.com/next/embed.js"></script>

How can I make it so that after filling out my form from this view, it automatically collects information about the page on which the form is being filled out?


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • January 15, 2024

Cześć @maksrybicki 

this is possible only by using the Typeform Embed SDK directly, not via snippet from the share page (the code you shared).

You can use a code like this to embed your typeform as slider:

<a href="#" id="tf">Aplikuj</a>
<link rel="stylesheet" href="//embed.typeform.com/next/css/slider.css" />
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
  document.querySelector('#tf').onclick = (event) => {
    event.preventDefault()
    window.tf.createSlider('fhRL6nmN', {
      hidden: { url_form: window.location.href }
    }).open()
  }
</script>

Hope this helps. 


  • Explorer
  • 2 replies
  • January 15, 2024
mathio wrote:

Cześć @maksrybicki 

this is possible only by using the Typeform Embed SDK directly, not via snippet from the share page (the code you shared).

You can use a code like this to embed your typeform as slider:

<a href="#" id="tf">Aplikuj</a>
<link rel="stylesheet" href="//embed.typeform.com/next/css/slider.css" />
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
  document.querySelector('#tf').onclick = (event) => {
    event.preventDefault()
    window.tf.createSlider('fhRL6nmN', {
      hidden: { url_form: window.location.href }
    }).open()
  }
</script>

Hope this helps. 

@mathio It works! Thank you very much!!! :)


  • Navigating the Land
  • 2 replies
  • February 13, 2024

Hello @mathio thanks a lot for the proposed solutions so far.

However, I’m looking for a way to make it work using a popup, not just a regular embed or slider. What would be the modifications needed to make this work?

Thanks a lot!


mathio-tf
Typeform
Forum|alt.badge.img+5
  • Typeform
  • 888 replies
  • February 13, 2024

Hello @Robbie7 

you can do that by reusing the very same code. All you need to do is replace the “createSlider” method name with “createPopup” in the JavaScript code (and of course using you own form ID instead of “fhRL6nmN”).

Good luck!


  • Navigating the Land
  • 2 replies
  • February 13, 2024
mathio wrote:

Hello @Robbie7 

you can do that by reusing the very same code. All you need to do is replace the “createSlider” method name with “createPopup” in the JavaScript code (and of course using you own form ID instead of “fhRL6nmN”).

Good luck!

You’re the best, thanks so much!


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 15008 replies
  • February 13, 2024

Let us know how it goes, @Robbie7 !


  • Explorer
  • 4 replies
  • June 12, 2024

edited to delete, got it working, it just loaded weird first time using the different embed code. thanks for your help y’all


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 15008 replies
  • June 13, 2024

Glad to hear it, @uxie ! Let us know if there’s anything else we can help with. 😀


  • Navigating the Land
  • 3 replies
  • February 12, 2025
mathio-tf wrote:

Hello @Robbie7 

you can do that by reusing the very same code. All you need to do is replace the “createSlider” method name with “createPopup” in the JavaScript code (and of course using you own form ID instead of “fhRL6nmN”).

Good luck!

Hi ​@mathio-tf,

How can I apply this to a side-tab? I've tried to replace “createSlider” to “createsidetab” but it doesn't work.

Can you help?

Thanks in advance.


  • Navigating the Land
  • 3 replies
  • February 13, 2025

Hi.

I am really struggling with the code to embed my typeform in a side tab. I need to get the url from the page where the form is submitted and I have tried this (for slider):

<a href="#" id="tf">Test</a>
<link rel="stylesheet" href="//embed.typeform.com/next/css/slider.css" />
<script src="//embed.typeform.com/next/embed.js"></script>
<script>
  document.querySelector('#tf').onclick = (event) => {
    event.preventDefault()
    window.tf.createSlider('tKpyHcNF', {
      hidden: { url_form: window.location.href }
    }).open()
  }
</script>

 I have tried to change “createSlider” to “createSidetab” but it doesn't work.

Any thoughts?

 

Thanks in advance.

 


  • Navigating the Land
  • 3 replies
  • February 13, 2025
Liz wrote:

Glad to hear it, @uxie ! Let us know if there’s anything else we can help with. 😀

Hi Liz, 

Can you help us with this?

How can I apply this to a side-tab? I've tried to replace “createSlider” to “createsidetab” but it doesn't work.

Thanks in advance.


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 15008 replies
  • February 13, 2025

Hi ​@ColorOnYou I’ve added your post here where we have an existing conversation! Since this workaround code was created by ​@jeremielp , you’ll want to ask them for additional help with it!


Reply