I have a form field, where we allow user to post a Youtube URL ( obviously there are tons of youtube type url variants )
My question is, how do we sanitize this element, to prevent users from posting:
- non youtube urls.
- onerous vulnerability hacks inc extraneous code and urls.
I read this post here
But I am somewhat bewildered how to implement the answer given by Jeff Attwood.
My form element at the moment is simply.
<div class="form-group col-lg-6 col-sm-12 underline">
<label>Add a Video from <strong>YouTube</strong></label>
<input type="text" name="video" id="choosevideo" class="form-control" tabindex="6" placeholder="YouTube Video URL">
</div>