Skip to content
Permalink
Browse files

Prevent an error on https font link

Chrome, Microsoft Edge and IE11 (and probably others too) complains about
notosansjapanese.css is not loaded over https if the page itself is
requested via https.  This is because the URL of file on googleapi server
is hardcoded with http, which bothers those browsers.

Thankfully DokuWiki provides a convenient function to query if the protocol
is https (apparently there are no straightforward way to do this with only
pure PHP APIs), which is is_ssl().  This may be a bit low-tech fix, but we
switch the schema on URL based on the return value of is_ssl().
  • Loading branch information...
msakuta committed Jun 25, 2016
1 parent 5b143d4 commit d28fab3feb473037733723624030824e0b848052
Showing with 1 addition and 1 deletion.
  1. +1 −1 action.php
@@ -41,7 +41,7 @@ public function metaheader(Doku_Event &$event, $param) {
$event->data['link'][] = array(
'type' => 'text/css',
"rel" => "stylesheet",
"href" => "http://fonts.googleapis.com/earlyaccess/notosansjapanese.css",
"href" => (is_ssl() ? "https" : "http") . "://fonts.googleapis.com/earlyaccess/notosansjapanese.css",
);
$files = array('SketchCanvas.js', 'draw.js', /*'i18next-1.7.2.min.js', 'js-yaml.min.js',*/ 'translation.js');
foreach($files as $file)

0 comments on commit d28fab3

Please sign in to comment.
You can’t perform that action at this time.