简体   繁体   English

从浏览器应用程序中从Silverlight执行javascript

[英]Executing javascript from Silverlight out of browser app

I have a silverlight app that uses JavaScript to process images from facebook. 我有一个Silverlight应用程序,该应用程序使用JavaScript处理来自Facebook的图像。 The JavaScript calls context.drawImage which throws a security exception (NS_ERROR_DOM_SECURITY_ERR) which I understood happens since the image is not hosted by my server, but from a different server (in this case facebook). JavaScript调用context.drawImage会引发安全异常(NS_ERROR_DOM_SECURITY_ERR),由于该图像不是由我的服务器托管,而是由其他服务器(在本例中为facebook)托管,因此我理解这种情况会发生。

After some research, I found that the correct permissions would be given to the app if run out of browser, but now I understood that I can't run the JavaScript since there is no browser to host it. 经过一番研究,我发现如果在浏览器中运行完该应用程序后,该应用程序将获得正确的权限,但是现在我知道我无法运行该JavaScript,因为没有浏览器可以托管它。

Is this correct? 这个对吗? If so, can anyone suggest a workaround for running the JavaScript with the needed permissions to access a image hosted by a different server. 如果是这样,任何人都可以提出一种解决方法,以具有访问其他服务器托管的图像所需的权限来运行JavaScript。

Thanks! 谢谢!

You are correct. 你是对的。 JavaScript cannot run because there's no browser to host it. JavaScript无法运行,因为没有浏览器来托管它。

The only solution is to rewrite the JavaScript. 唯一的解决方案是重写JavaScript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM