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();
}
});