Submitting to this Google page is not possible due to the presence of an anchor #
in the URL. This indicates that it does not follow the standard GET format that would typically be used when submitting a form to a URL. To overcome this, you will need to calculate the correct URL either using JavaScript or on the back-end.
If you opt for creating the correct URL using JavaScript, you can utilize the function encodeURIComponent(url)
to properly escape the parameter.
Below is an example illustrating how this can be achieved:
var searchBox = document.querySelector('.search');
var form = document.querySelector('.form');
form.addEventListener('submit', function(event) {
var value = searchBox.value;
var escapedValue = window.encodeURIComponent(value);
var url = "https://www.google.no/#q=" + escapedValue
alert(url);
window.location.href = url;
event.preventDefault();
});
<form class="form" action="test">
<input class="search" name="q" placeholder="Search...">
<input type="submit" class="submit" value="Submit">
</form>