跨域PDF载入中 [英] Cross domain pdf loading
问题描述
我有这样的一个网站:
我有一个PDF文件生成一个文件夹在 http://www.example.com/mypdfs/mypdf.pdf ;但后来我需要从那里使用javascript从 http://subdomain.example.com 加载PDF文件是在子同一文件夹中,但当然我得到一个跨域错误,我怎么能解决这个问题?我怎么能告诉Apache允许跨域访问此子?
I have a website with something like this: I have a folder with generated pdfs at http://www.example.com/mypdfs/mypdf.pdf; but then I need to load pdfs from there using javascript from http://subdomain.example.com which is subdomain in the same folder, but of course I am getting a crossdomain error, how can I solve this? how can I tell apache to allow cross domain access to this subdomain?.
推荐答案
您将需要修改你的.htaccess文件,以允许跨域原点,则需要添加:
You'll need to modify your .htaccess file to allow cross domain origin, you need to add :
Header set Access-Control-Allow-Origin "*"
启用了Apache CORS
这篇关于跨域PDF载入中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!