I've been running into multiple issues with utilizing custom fonts at the following location:
www.shawmut.com/happyholidays
I ran into an issue yesterday with Mozilla Firefox and it not displaying a custom font I was linking to our AWS S3 Bucket, which I resolved by hosting the fonts of our actual web server. Now, I'm experiencing an issue with IE9/10 where the fonts are not displaying once again. I found the following discussion here: IE9 Refusing to Load custom font? which somewhat touches on my issue, however, I'm not running an Apache or a nginx setup, I'm on IIS (without actual IIS access).
Here is the CSS code:
/* GOBOLD */
#font-face {
font-family: 'Gobold';
src: url('www.shawmut.com/happyholidays/fonts/Gobold.eot');
src: url('www.shawmut.com/happyholidays/fonts/Gobold.eot#iefix') format('embedded-opentype'),
url('www.shawmut.com/happyholidays/fonts/Gobold.eot?') format('eot'),
url('www.shawmut.com/happyholidays/fonts/Gobold.woff') format('woff'),
url('www.shawmut.com/happyholidays/fonts/Gobold.ttf') format('truetype'),
url('www.shawmut.com/happyholidays/fonts/Gobold.svg#Gobold') format('svg');
font-weight: normal;
font-style: normal;
}
/* MOTION PICTURE */
#font-face {
font-family: 'MotionPicture';
src: url('www.shawmut.com/happyholidays/fonts/MotionPicture.eot');
src: url('www.shawmut.com/happyholidays/fonts/MotionPicture.eot#iefix') format('embedded-opentype'),
url('www.shawmut.com/happyholidays/fonts/MotionPicture.eot?') format('eot'),
url('www.shawmut.com/happyholidays/fonts/MotionPicture.woff') format('woff'),
url('www.shawmut.com/happyholidays/fonts/MotionPicture.ttf') format('truetype'),
url('www.shawmut.com/happyholidays/fonts/MotionPicture.svg#MotionPicture') format('svg');
font-weight: normal;
font-style: normal;
}
Can someone PLEASE assist me with resolving this issue, it's kind of driving me bonkers! :)
CORS
Start by using relative paths, you'll run into problems when someone accesses your site with a non www prefixed URL, as some browsers then won't load your font because of cross origin resource restrictions.
Of course this could be fixed by sending proper headers, but sticking to relative paths is the smarter option here.
See also https://developer.mozilla.org/en/docs/HTTP/Access_control_CORS
Content types
Make sure that your server sends the proper Content-Type headers, browsers can be picky about that.
.ttf > application/octet-stream
or application/x-font-ttf
or application/x-font-truetype
.eot > application/vnd.ms-fontobject
.woff > application/font-woff
.svg > note sure, probably image/svg+xml
Missing files
Also some files are not available, specifically the .woff and .svg ones, so in case the .eot ones cannot be used (there are a lot of EOT fonts around that do not comply with the Microsoft standard, often produced by font converters) there is no fallback available.
Developer tools
In case the above doesn't fix the problem, check the network and console tabs in the developer tools, they might give you a clue in case the font files are really not being loaded/used.
I've run into similar problems with custom fonts, one of the things I put in place was an outbound URL rewrite rule so that when fonts were requested, the server would add a CORS header. This seems to have fixed the problem for me, so it's worth a try.
You'll need URL Rewrite installed on your web server (http://www.iis.net/downloads/microsoft/url-rewrite) for this to work.
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Fonts CORS">
<match serverVariable="RESPONSE_Access_Control_Allow_Origin" pattern=".*" />
<conditions>
<add input="{REQUEST_URI}" pattern=".*\.(ttf|otf|eot|woff|svg)\?*.*$" />
</conditions>
<action type="Rewrite" value="*"/>
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
We tried all proposed solutions and spent hours researching why our custom font with icons doesn't load in IE9 for some of our website users -- only to find out that it was the security setting in IE9 which prevented the font files from being loaded.
Going to Internet Options > Security > Internet > Medium fixed the issue, all the custom icons loaded and looked perfect like in the most modern browsers.
Please note that we don't use Windows, we only use it for testing through Parallels on a Mac, but I hope it will save some time for at least some of you.
Related
I'm learning about database doing a walk through to build a project. I don't have full knowledge about how the code works and I ended up having the following issue:
The project has 3 pages until now, and all use one Bulma file for the stylesheet. It is working for the first full pages, but on the third one the CSS is not loading with the page.
It appoints the following error on the browser console:
Refused to apply style from
'http://localhost:3000/checklists/stylesheets/bulma.min.css' because
its MIME type ('text/html') is not a supported stylesheet MIME type,
and strict MIME checking is enabled.
Going straight to the directory it gives:
Cannot GET /checklists/stylesheets/bulma.min.css
On the network tab it shows that X-Content-Type-Options = nosniff, and the Content-Type = text/html when it should be text/css.
Also, according to this site, it seems that the CSS file is not being found for some reason.
I've checked the link and it seems to be right and it also work properly on the other pages, and from what I understand about the subject, the rest of the code should be working as well.
<link rel="stylesheet" type="text/css" href="stylesheets/bulma.min.css" />
I checked the code and changed some stuff trying to solve, but nothing worked and I've reverted the changes.
Could someone help me to solve this issue?
You can check the files here.
For the the project it is being used:
MongoDB
Mongoose
Express
Path
EJS
Thanks in advance.
I am trying to use a custom font on my client's course marketing page on Teachable.com. Right now the course is not currently live, so unfortunately I can't share a link to preview.
I am trying to follow the Google Webfonts pattern of attributes in the link tag:
<link rel="preconnect" href="https://tablocreative.com/roo/webfonts.css" crossorigin>
I am hosting this webfont and the respective font files on a different hosting provider (standard Apache hosting). When I view the source of my page, I can see that file is being referenced - no 404 errors or access origin errors in the console.
This is the CSS:
html, body, main, div, p { font-family: 'Avenir LT Pro'; }
I can see in the inspector that declaration is being applied, no other font-family is set or overriding this. But the webfont will not load.
Any insights or ideas would be appreciated!
Check out the codepen on the readme of this repo.
It has a working example:
https://github.com/adriano-tirloni/google-fonts-css2
I developed a website locally using "localhost" and created all the site links, buttons, etc using a relative path structure. My server code is written in Node.js/Express. I am also using .ejs for a template engine...therefore all my server webpages are in a folder called "views/pages".
Using this structure, for example, I have a button with a link coded as:
Enter Site
On my development 'localhost' machine this was sufficient to call the '_landing' route in my server script which would then render the proper page to be served...without any difficulty. The server code would read something like this:
app.get('/', function (req, res) {
res.render('pages/_splash');
});
app.get('/_landing', function(req, res) {
res.render('pages/_landing', {user_stat: _subscriber});
});
Now I have uploaded my site files to a Windows server using Plesk software. The site files and folders are located in a directory named "httpdocs". It now seems my relative path links are broken. Using the button link above again as an example for some reason it now wants to route to "https://example.com/_landing"...which is obviously not correct. Why does it seem the relative path now seems to ignore the route call in Node.js...?
Any advice greatly appreciated, I am having extreme difficulty posting my site online due to a myriad of undocumented problems like this...posting a request to my server support will be useless since they do not respond to "coding issues". I thank you in advance.
For anybody that may be interested after several weeks I was able to determine the problem here. I eventually enlisted Plesk support in an effort to solve this issue. It was confirmed to me by a Plesk technician that my described issue was caused by a bug in the Plesk software platform.
The solution to resolve the bug was to insert some additional code in the 'web.config' file as follows:
<rewrite>
<rules>
<remove name="startup-file for site #1" />
<rule name="startup-file for site #1">
<match url="/*" />
<conditions />
<serverVariables />
<action type="Rewrite" url="/test2.js" />
</rule>
</rules>
</rewrite>
This code is to appear in the 'web.config' file AFTER "/httpErrors" AND WITHIN "/system.webServer"...the 'test2.js' should be set to the JS script file for your domain.
IIS MimeTypes
I have an image tag with an svg file:
<img src="/uploadedImages/temp/Example.svg?n=9368" alt="testsvg" title="testsvg" align="middle">
which won't display in any browser. I can see in Developer Tools that the Content-Type is coming through as application/octet-stream. However, in IIS 7.5, I DO have the MIME-Type set as image/svg+xml (see attached screenshot in link "IIS MimeTypes" above). I also tried setting it in the web.config as follows:
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
but that also did not help. What am I missing? How do I get the correct Mime-type to load so that the image can show in the browser?
(By the way, in IE, if I browse to the file's location, the image DOES show. But not in Chrome and Firefox, they merely want to download the file instead of display it.)
I've compressed all the java scripts and style sheets as an individual files, after compression its about 582 KB. While it is loaded in the web page the chrome browser inspect elements network displays 168 KB, similarly when I browse in safari the network displays the file size as un-compressed 582 KB. It seems the compressing process has not occurred.
Many articles says that safari browser wont support the gzip compression.
Please guide me a to roll out this issue.!
Thanks in advance...!!
This is may not be a perfect solution but this may help you
according to http://www.webveteran.com/blog/index.php/web-coding/coldfusion/fix-for-safari-and-gzip-compressed-javascripts/ you may try to send format as "jgz" instead "gz"
according to Why is gzip compression with Internet Explorer not working? you may check whether you are passing correct header
Content-Encoding : gzip
It can also be server side issue
Yes, send as jgz for it to work in Safari and add some headers for IE. Here is a coldFusion example:
<cfheader name="Content-type" value="text/javascript">
<cfheader name="Vary" value="Accept-Encoding">
<cfheader name="Content-Encoding" value="gzip">
<cfheader name="Content-Disposition" value="inline; filename=""#cacheKey#.jgz""">
<cfcontent file="#file#" deleteFile="no">
Alternatively you can opt to not compress the concatenated file in your code, and let your web server do that work for you. Then there is nothing to wonder about. Here is that example code in IIS (web.config):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
...
Live Example using IIS for gzipping. The download is 40KB. The unzipped content is 110KB.
Safari only shows the unzipped size. But firebug shows the download size.