问题
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?.
回答1:
You'll need to modify your .htaccess file to allow cross domain origin, you need to add :
Header set Access-Control-Allow-Origin "*"
Enabling CORS in apache
来源:https://stackoverflow.com/questions/34109354/cross-domain-pdf-loading