Rails: determining whether to use SSL for url() in CSS -
suppose had file fonts.css.scss
following:
@font-face { font-family: 'play'; font-style: normal; font-weight: bold; src: local('play-bold'), url('http://themes.googleusercontent.com/static/fonts/play/v3/abigxw3ilixho08ckkyt9gluueptyoustqem5amljo4.woff') format('woff'); }
if application requested via ssl, font file above still requested insecurely, many browsers don't , complain about.
i tried renaming file font.css.erb
, , trying use request.ssl?
determine whether use http or https, apparently request
undefined in assets.
so, can change have font loaded on ssl if necessary?
the problem css files in assets directory compiled static assets, need snippet of css dynamic. if that's url you're worried about, put view. if there's lots of url's referenced in css make 2 different css files, 1 https friendly , 1 not. dynamically decide file load view.
Comments
Post a Comment