Streaming live at 10am (PST)

How to allow Webflow Forms to get current URL?

I’ve got a site with articles (~ blog posts) built with CMS, and there is a Submission Form below EACH article.

So, people can submit an inquiry that may relevant to that specific article they are currently visiting.

How to allow Webflow Forms to get the current article’s URL? The goal is to let our side being able to receive emails with that URL, so that we can better follow-up the case.

Thank you very much!

Custom code is the solution. Look at this post for guidance. There are others available as well.

you could use a little bit of javascript to capture the current URL and inject it into a hidden input field which would be in your Webflow form.

the HTML input field could look like this:

<input type="hidden" id="url" name="url" value="">

The JavaScript could look like this:

(function getURL() {
  let input = document.getElementById("url");
  let url = window.location.href;
  input.value = url;


1 Like

Thanks a lot for the codes.

Where should the Javascript be placed? Setting > Custom Code > Header Code?

And how about the HTML? Place inline?

The javascript should be wrapped within its tags and placed I would say at page level, inside the custom code section and before the end of the tag.

The HTML should simply be an Webflow embed, placed somewhere inside your form. It wont be visible since the input has a type “hidden”.

1 Like