Support Forums

Support Offline : Mon - Fri / 10am - 6pm (GMT +6)

Your Time: Our Time:

Webfonts broken under ssl/https

Featured Lock Resolved
Webfonts do not load when the site is running under https!

5 Answers

Cameron James

More than a month ago #Permalink

if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
self::getInstance()->document->addStyleSheet("https://fonts.googleapis.com/css?family="; . $name);
} else {
self::getInstance()->document->addStyleSheet("http://fonts.googleapis.com/css?family="; . $name);
}


It works like a dream, thanks for your help and pls to ad my code above to the next templates u are making and perhaps an update for SportsOn :P thankyou brother


Id just like to also point out this code above is not correct, the shaper forum article display bizo has reformatted it so its syntax is not correct but u get the idea!

Jakir hasan - Staff

More than a month ago #Permalink
Hi ibanez0r,
Do you use our latest sportson template or sports?

Note: If you are using latest Sportson then go to the following path "plugins->system->helix->core" open helix.php Line No. 1333

self::getInstance()->document->addStyleSheet("http://fonts.googleapis.com/css?family="; . $name);

Just use

self::getInstance()->document->addStyleSheet("https://fonts.googleapis.com/css?family="; . $name);


Note: make sure take a backup



Thanks

Cameron James

More than a month ago #Permalink
will this affect users not using ssl mode? I think if i do this it will throw an error/warning every time someone loads a page using http:// ?

Cameron James

More than a month ago #Permalink
You know what would be ideal is a short piece of php to detect if the user is using ssl or not then a switch for http/https

maybe something like this, will it work?

if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
self::getInstance()->document->addStyleSheet("https://fonts.googleapis.com/css?family="; . $name)
} else {
self::getInstance()->document->addStyleSheet("http://fonts.googleapis.com/css?family="; . $name);
}


There are no replies made for this post yet.
Be one of the first to reply to this post!

Leaderboard (30 days)

Paul Frankowski

Paul Frankowski

Total Accepted Answers: 129
Sifat

Sifat

Total Accepted Answers: 88
Toufiq

Toufiq

Total Accepted Answers: 41
Pavel

Pavel

Total Accepted Answers: 6
Al Mamun

Al Mamun

Total Accepted Answers: 3

114

Templates

292537

Community Users

Newsletter

Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.
We never spam

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries. JoomShaper.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Connect Us