This question is directly related to this other question found on StackOverflow.
I have the same problem - but I'm not sure I can separate the protocol prefix as another variable, as suggested in the above question. I'm using the GET action, sent to another page where the data is used (e.g. form on index.php submits GET to search.php).
On the index page, a user can type data, including a URL, to be submitted (e.g. text field and submit button). Due to the nature of URLs, I expect to have some people who copy and paste - and thus people are likely going to include the http:// sometimes, whether I want them to or not.
If http: is included in the GET request (e.g. search.php?q=http://google.com), then I receive a 403 Forbidden error on search.php - which is where I'm running into issues.
Outside of JS, is there a way to either remove or separate the protocol prefix from a user input, if it exists, before the request is sent to search.php? E.G. After user clicks submit but before data is sent to another page?
Thanks in advance for any answers or advice you can give!
EDIT: I know I can use urlencode to encode URLs - but can that be done before the data/GET request is actually sent?
onsubmit="somefunction()"and do whatever you want to do bydocument.forms["form"]["url_input"].value