2013-10-12 145 views
0

嗨,我有图像选择器控件选择图像,然后将图像上传到服务器。而且我必须在所有浏览器中都能正常工作的同一页面中预览所选图像,但不能在safari(我的5.1.7版本)中使用。这是我的代码。请提前帮助解决此问题。Safari浏览器中不显示图像预览5.1.7

jQuery('#image').on('change', function() 
{ 
    ext = jQuery(this).val().split('.').pop().toLowerCase(); 
    if (jQuery.inArray(ext, ['gif', 'png', 'jpg', 'jpeg']) == -1) { 
    resetFormElement(jQuery(this)); 
    window.alert('Not an image!'); 
    } 
    else 
    { 
    file = jQuery('#image').prop("files")[0]; 
    blobURL = window.URL.createObjectURL(file); 
    jQuery('#image_preview img').attr('src', blobURL); 
    jQuery('#image_preview').slideDown(); 
    jQuery(this).slideUp(); 
    } 
}); 

回答