{"id":1011,"date":"2017-01-26T09:58:39","date_gmt":"2017-01-26T14:58:39","guid":{"rendered":"http:\/\/easy-admin.ca\/?p=1011"},"modified":"2017-08-04T09:41:30","modified_gmt":"2017-08-04T13:41:30","slug":"icons-not-appearing-on-my-website","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2017\/01\/26\/icons-not-appearing-on-my-website\/","title":{"rendered":"Website Icon Not Showing Up?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1012 size-full\" src=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-not-showing.png\" alt=\"\" width=\"623\" height=\"58\" srcset=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-not-showing.png 623w, https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-not-showing-300x28.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/p>\n<p>The icons \u2013 including submenu indicator arrows \u2013 for example in UberMenu are font icons. Some browsers \u2013 most commonly Firefox \u2013 enforce a Cross-origin resource sharing (CORS) restriction policy for fonts. As a result, if you serve the Font Awesome fonts from a separate domain, Firefox (and depending on your server configuration, other browsers as well), will not load the fonts due to this policy, so the icons are not displayed.<\/p>\n<h4>CDN (Content Delivery Network)<\/h4>\n<p>The most common occurrence is using a CDN. For example, if your site is <code>mydomain.com<\/code>, but your stylesheets are served from <code>cdn.mydomain.com<\/code>, or <code>cdn.someotherdomain.com<\/code>, the browser will not load the fonts because they are served from another domain.<\/p>\n<h4>The Solution<\/h4>\n<p>There are two options to resolve the issue: either serve your fonts from the same domain as your site, or configure the fonts on your secondary domain to be served with the appropriate headers to allow cross-origin resource sharing.<\/p>\n<h5>Serve the files from the same domain<\/h5>\n<p>This generally means that you would exclude the Font Awesome files from your CDN, and link the files on your main server instead. The font file itself is the important resource, but generally this would come down to excluding the Font Awesome stylesheet. If you\u2019re using UberMenu\u2019s copy, it is found at<\/p>\n<p><code>\/wp-content\/plugins\/ubermenu\/assets\/css\/fontawesome\/css\/font-awesome.min.css<\/code><\/p>\n<p>This solution will work, but you won\u2019t be able to take advantage of your CDN for these files.<\/p>\n<h5>Set the font headers to allow cross-origin resource sharing<\/h5>\n<p>This means that you would configure your server to tell the browser that it\u2019s okay to load these resources from a different domain.<\/p>\n<p>What you\u2019ll need to do is set the <code>Access-Control-Allow-Origin<\/code> header to <code>*<\/code> for the fonts. If your server is running apache, this generally just means dropping an <code>.htaccess<\/code> file into the directory containing the font with the following configuration<\/p>\n<p><strong>&lt;FilesMatch &#8220;.(eot|ttf|otf|woff)&#8221;&gt;<\/strong><br \/>\n<strong> Header set Access-Control-Allow-Origin &#8220;*&#8221;<\/strong><br \/>\n<strong> &lt;\/FilesMatch&gt;<\/strong><\/p>\n<p><strong>You may have to check your Theme directory if you are not using UberMenu&#8217;s Font Awesone&#8230;<\/strong><\/p>\n<p><span style=\"color: #ff0000;\"><strong>wp-content\/themes\/theme_name\/fonts<\/strong><\/span> and simply add the file<br \/>\n.htaccess in the directory!<\/p>\n<p>UberMenu\u2019s Font Awesome assets are located in <code>\/wp-content\/plugins\/ubermenu\/assets\/css\/fontawesome\/fonts\/<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1014 size-full\" src=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-showing.png\" alt=\"\" width=\"623\" height=\"58\" srcset=\"https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-showing.png 623w, https:\/\/easy-admin.ca\/wp-content\/uploads\/2017\/01\/icon-showing-300x28.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/p>\n<p><strong>[Experimental] for SSL website<\/strong><\/p>\n<p>Header add Access-Control-Allow-Origin &#8220;https:\/\/www.domain.com&#8221;<br \/>\n#Header add Access-Control-Allow-Origin &#8220;https:\/\/domain.com&#8221;<br \/>\nRewriteEngine On<br \/>\nRewriteCond %{HTTPS} !=on<br \/>\nRewriteRule ^\/?(.*) https:\/\/%{SERVER_NAME}\/$1 [R,L]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The icons \u2013 including submenu indicator arrows \u2013 for example in UberMenu are font icons. Some browsers \u2013 most commonly Firefox \u2013 enforce a Cross-origin resource sharing (CORS) restriction policy for fonts. As a result, if you serve the Font Awesome fonts from a separate domain, Firefox (and depending on your server configuration, other browsers &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2017\/01\/26\/icons-not-appearing-on-my-website\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Website Icon Not Showing Up?<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1011","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=1011"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/1011\/revisions"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=1011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=1011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}