在safari中使用window.url的替代方案 [英] Alternative for window.url in safari

查看:80
本文介绍了在safari中使用window.url的替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有替代

window.URL = window.URL || window.webkitURL;

我试图使用以下代码片段预览用户上传的图片:

for Safari 5 and below?? Am trying to preview the image uploaded by the user using following snippet :

var file = jQuery('#brandImageUpload').prop("files")[0];
window.URL = window.URL || window.webkitURL ;
var blobURL = window.URL.createObjectURL(file);
$('#ibrandImage').attr('src', blobURL);
$('#brandImage').slideDown();
$(this).slideUp();

但是window.URL返回undefined。

But window.URL returns undefined.

推荐答案

根据 http:// caniuse.com ,Safari 5.1及以下版本不支持此功能。

According to http://caniuse.com, this functionality is simply not supported by Safari 5.1 and below.

重要的是了解IE9及以下,Opera Mini和其他一些小型桌面和移动浏览器都不支持它。所以,可能最好避免使用它。

It is important to understand that it is not supported by either IE9 and below, Opera Mini and some other minor desktop and mobile browsers. So, probably, it is better to avoid using it.

这篇关于在safari中使用window.url的替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆