Google Chrome blocks ajax requests when print preview is opened on child window

后端 未结 4 1841
迷失自我
迷失自我 2020-12-09 09:46

There are 2 files: index.html and print.html

First one contains a button that opens print.html using simple command:



        
4条回答
  •  抹茶落季
    2020-12-09 10:31

    Your server not added ORIGIN headers. You need add it on .htaccess. For example:

    Header add Access-Control-Allow-Origin "*"
    Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
    Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
    

    Or you can add it in PHP on print.html (if you can use PHP on html files)

    header ("Access-Control-Allow-Origin: *");
    header ("Access-Control-Allow-Headers: origin, x-requested-with, content-type");
    header ("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
    

提交回复
热议问题