I have a form with an image upload field. When the user selects an image from the desktop, the preview box displays the image (before uploading occurs). My script works on Firefox and Chrome but it doesn't work on Safari (Windows). Below is the code I have right now:

HTML Code:
<!DOCTYPE html>
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
	function readURL(input) {
		if (input.files && input.files[0]) {
			var reader = new FileReader();
			reader.onload = function (e) {
				$('#preview').attr('src', e.target.result);
	<input type='file' onchange="readURL(this);" />
	<img id="preview" src="" />
Is there a way to make it also work on Safari (Windows)?