how to use CORS mechanism in native client

爱⌒轻易说出口 提交于 2019-12-13 03:16:54

问题


For example,I hava a pnacl myapp.pexe , And my website is www.A.com. and myapp.pexe and www.A.com are on the same server. However, the website www.B.com need to access the myapp.pexe. And i got a error, Native Client: access to manifest url was denied.

Using CORS can slove this problem? If using CORS can slove this problem, how to do ?


回答1:


This answer is not Native Client specific. Accessing Native Client resources from another origin uses the standard CORS mechanism.

To answer your question, though:

This can be done by setting up the correct CORS response headers on the A.com server. There are many online resources that can describe how to do this: take a look at http://www.html5rocks.com/en/tutorials/cors/ for example.

For the simplest case, the solution is to return one additional header in the GET response for myapp.pexe and myapp.nmf:

Access-Control-Allow-Origin: http://A.com

There are more headers that are required for other request method types, content types, sending credentials, etc.



来源:https://stackoverflow.com/questions/28781808/how-to-use-cors-mechanism-in-native-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!