How to include current URL in a form?

… I might have found a solution …

<script type="text/javascript">
            
window.onload=function()
{document.getElementById('pageurl').value = window.location.href;}

</script>

<input type="hidden" id="pageurl"  name="pageurl" value="pageurl" />

… seems to work fine.

Is that option ok or is there a better way (to write the code)?

Thanks!

All the best,
Michael

UPDATE: One last problem remains … I got 4 forms on each page and all form should include the URL. It works for one form but the other forms show “pageurl: pageurl” in the mail, when I include the identical embeded widget. Any idea?

2 Likes