<input class="some-class" type="hidden" name="url">
// jQuery
$(function ($) {
$('.some-class').val(window.location.href);
});
// js
document.addEventListener("DOMContentLoaded", () => {
let urlInput = document.querySelector('.some-class');
urlInput.value = window.location.href;
});