Improved URL javascript validation for file preview