Issue
Error: Access to Font at 'http://www.example.com//assets/global/plugins/font-awesome/fonts/fontawesome-webfont.woff2?v=4.4.0' from origin 'http://example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
Solution:
<?php
header('Access-Control-Allow-Origin: *');
class Home extends CI_Controller {
public function index()
{
$this->load->view('master');
}
}
?>
I tried this Solution but it not working can you please help me How to resolve it? and How to remove index.php from URL?
Solution
Try allowing GET & OPTIONS
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: GET, OPTIONS");
If the above doesn't work, try allowing access to font resources via .htaccess
(for apache) or in nginx server block - add these lines:
# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
or
# nginx config
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}
Answered By - Latheesan
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.