您好,从以下代码我能够下载chrome& amp; firefox但没有在safari浏览器中工作,它正在抛出错误
TypeError:'undefined'不是函数(评估'canvas.toBlob(blobCallback('wallpaperdeae'))')
$( “#保存”)。单击(函数(){
function blobCallback(iconName) {
return function (b) {
var a = document.getElementById('download');
a.download = iconName + ".jpg";
a.href = window.URL.createObjectURL(b);
}
}
canvas.toBlob(blobCallback('wallpaperdeae'));
});
感谢
答案 0 :(得分:7)
我不认为Safari支持toBlob方法:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#Browser_compatibility
据此,它仅适用于Chrome 50+和Firefox(19+用于基本支持,25+用于图像质量参数),在IE 10及更高版本中有一些基本支持。
所以对Safari没有任何支持。
答案 1 :(得分:0)
有一个"low performance polyfill based on toDataURL
" posted on MDN
12:04:49,360 ERROR [AppServiceLocator] [ERROR IN AppServiceLocator:] javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection timed out: no further information]
12:05:10,403 ERROR [AppServiceLocator] [ERROR IN AppServiceLocator:] javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection timed out: no further information]
12:05:31,408 ERROR [AppServiceLocator] [ERROR IN AppServiceLocator:] javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection timed out: no further information]
12:05:31,408 ERROR [AppServiceLocator] [ERROR IN GETTING REMOTE HOME:] interface com.ipacs.framework.controller.interfaces.ServerControllerHome
12:05:31,410 ERROR [EJBModelLoader] [AppServiceLocatorException:]
com.ipacs.als.gui.exception.AppServiceLocatorException: [ERROR IN GETTING REMOTE HOME:] interface com.ipacs.framework.controller.interfaces.ServerControllerHome
at com.ipacs.als.gui.util.AppServiceLocator.getRemoteHome(AppServiceLocator.java:93)
at com.ipacs.als.gui.model.EJBModelLoader.doBusinessAction(EJBModelLoader.java:83)
at com.ipacs.als.gui.model.EJBModelLoader.doBusinessEvent(EJBModelLoader.java:66)
at com.ipacs.als.gui.model.ModelLoader.doBusiness(ModelLoader.java:37)
at com.ipacs.als.gui.model.BusinessEventHelper.callBizService(BusinessEventHelper.java:285)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:175)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:167)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:162)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:348)
at com.ipacs.ntuc.Startup.initProject(Startup.java:232)
at com.ipacs.ntuc.Startup.main(Startup.java:223)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
12:05:31,420 ERROR [Startup] com.ipacs.als.gui.exception.AppServiceLocatorException: [ERROR IN GETTING REMOTE HOME:] interface com.ipacs.framework.controller.interfaces.ServerControllerHome
Kewill Forwarding Application Run Time Exception
at com.ipacs.als.gui.model.EJBModelLoader.doBusinessAction(EJBModelLoader.java:104)
at com.ipacs.als.gui.model.EJBModelLoader.doBusinessEvent(EJBModelLoader.java:66)
at com.ipacs.als.gui.model.ModelLoader.doBusiness(ModelLoader.java:37)
at com.ipacs.als.gui.model.BusinessEventHelper.callBizService(BusinessEventHelper.java:285)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:175)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:167)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:162)
at com.ipacs.als.gui.model.BusinessEventHelper.doBusiness(BusinessEventHelper.java:348)
at com.ipacs.ntuc.Startup.initProject(Startup.java:232)
at com.ipacs.ntuc.Startup.main(Startup.java:223)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.ipacs.als.gui.exception.AppServiceLocatorException: [ERROR IN GETTING REMOTE HOME:] interface com.ipacs.framework.controller.interfaces.ServerControllerHome
at com.ipacs.als.gui.util.AppServiceLocator.getRemoteHome(AppServiceLocator.java:93)
at com.ipacs.als.gui.model.EJBModelLoader.doBusinessAction(EJBModelLoader.java:83)
... 18 more
12:05:52,566 ERROR [AppServiceLocator] [ERROR IN AppServiceLocator:] javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection timed out: no further information]
12:06:13,575 ERROR [AppServiceLocator] [ERROR IN AppServiceLocator:] javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection timed out: no further information]