- Posts: 2
- Home
- Forum
- Community Forum
- General discussions
- Book this room button
Styles and scripts entered with an absolute reference
- mion
- Topic Author
- Offline
Less
More
2 years 5 months ago #18734
by mion
Styles and scripts entered with an absolute reference was created by mion
Hi,
I have a problem with using your component in a "reverse proxy" architecture.
In particular, some resources, scripts and style sheets are absolutely referenced.
Eg:
<script src = "www.ca-mura.com/media/com_solidres/asset...uery.validate.min.js" type = "text / javascript">
<script src = "www.ca-mura.com/media/com_solidres/asset...ional-methods.min.js" type = "text / javascript">
<script src = "www.ca-mura.com/media/com_solidres/asset...on/messages_it-IT.js" type = "text / javascript">
This is the code:
lib_solidres\solidres\html\jquery.php
In other cases, however, a relative address is used correctly.
Eg:
<script src="/media/com_solidres/assets/js/site.min.js?5987b1692662860f8d3241d7d06a8ff8" type="text/javascript"></script>
This is the code:
lib_solidres\solidres\html\js.php
Could you change code and use:
The same $options should also be used wherever the "relative" parameter is not used, eg:
lib_solidres\solidres\html\jquery.php:
public static function editable()
public static function ui()
public static function cookie()
...
Thanks for support
I have a problem with using your component in a "reverse proxy" architecture.
In particular, some resources, scripts and style sheets are absolutely referenced.
Eg:
<script src = "www.ca-mura.com/media/com_solidres/asset...uery.validate.min.js" type = "text / javascript">
<script src = "www.ca-mura.com/media/com_solidres/asset...ional-methods.min.js" type = "text / javascript">
<script src = "www.ca-mura.com/media/com_solidres/asset...on/messages_it-IT.js" type = "text / javascript">
This is the code:
lib_solidres\solidres\html\jquery.php
public static function validate()
{
// Only load once
if (!empty(static::$loaded[__METHOD__]))
{
return;
}
JHtml::_('jquery.framework');
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/jquery.validate.min.js', false, false);
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/additional-methods.min.js', false, false);
$activeLanguageTag = JFactory::getLanguage()->getTag();
$allowedLanguageTags = array('ar-AA', 'bg-BG', 'ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-AR', 'es-ES', 'et-EE',
'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hr-HR', 'hu-HU', 'it-IT', 'ja-JP', 'ko-KR', 'lv-LV', 'nb-NO', 'nl-NL',
'pl-PL', 'pt-BR', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-TW'
);
// English is bundled into the source therefore we don't have to load it.
if (in_array($activeLanguageTag, $allowedLanguageTags))
{
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/localization/messages_' . $activeLanguageTag . '.js', false, false);
}
static::$loaded[__METHOD__] = true;
return;
}
In other cases, however, a relative address is used correctly.
Eg:
<script src="/media/com_solidres/assets/js/site.min.js?5987b1692662860f8d3241d7d06a8ff8" type="text/javascript"></script>
This is the code:
lib_solidres\solidres\html\js.php
public static function site()
{
// Only load once
if (!empty(static::$loaded[__METHOD__]))
{
return;
}
JHtml::_('script', 'com_solidres/assets/site.min.js', array('version' => SRVersion::getHashVersion(), 'relative' => true));
static::$loaded[__METHOD__] = true;
return;
}
Could you change code and use:
public static function validate()
{
// Only load once
if (!empty(static::$loaded[__METHOD__]))
{
return;
}
$options = ['relative' => true, 'path_only' => false, 'detect_browser' => false];
JHtml::_('jquery.framework');
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/jquery.validate.min.js', $options);
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/additional-methods.min.js', $options);
[size=2][/size]
$activeLanguageTag = JFactory::getLanguage()->getTag();
$allowedLanguageTags = array('ar-AA', 'bg-BG', 'ca-ES', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-AR', 'es-ES', 'et-EE',
'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hr-HR', 'hu-HU', 'it-IT', 'ja-JP', 'ko-KR', 'lv-LV', 'nb-NO', 'nl-NL',
'pl-PL', 'pt-BR', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-TW'
);
// English is bundled into the source therefore we don't have to load it.
if (in_array($activeLanguageTag, $allowedLanguageTags))
{
JHtml::_('script', SRURI_MEDIA . '/assets/js/validate/localization/messages_' . $activeLanguageTag . '.js', false, false);
}
static::$loaded[__METHOD__] = true;
return;
}
The same $options should also be used wherever the "relative" parameter is not used, eg:
lib_solidres\solidres\html\jquery.php:
public static function editable()
public static function ui()
public static function cookie()
...
Thanks for support
Please Log in or Create an account to join the conversation.
- solidres
- Offline
Less
More
- Posts: 2834
2 years 5 months ago #18741
by solidres
FAQ: www.solidres.com/support/frequently-asked-questions
Support Policy: www.solidres.com/support-policy
Replied by solidres on topic Styles and scripts entered with an absolute reference
Hi,
Yes, we can confirm this issue, some code written long time ago used absolute URL.
We will update them in v2.12.6 (v2.12.5 has been released last weekend).
The correct use should be (no need to use const SRURI_MEDIA)
JHtml::_('script', 'com_solidres/assets/validate/jquery.validate.min.js', $options);
Regards,
Yes, we can confirm this issue, some code written long time ago used absolute URL.
We will update them in v2.12.6 (v2.12.5 has been released last weekend).
The correct use should be (no need to use const SRURI_MEDIA)
JHtml::_('script', 'com_solidres/assets/validate/jquery.validate.min.js', $options);
Regards,
FAQ: www.solidres.com/support/frequently-asked-questions
Support Policy: www.solidres.com/support-policy
The following user(s) said Thank You: joomleb
Please Log in or Create an account to join the conversation.
- mion
- Topic Author
- Offline
Less
More
- Posts: 2
2 years 5 months ago #18742
by mion
Replied by mion on topic Styles and scripts entered with an absolute reference
Awesome!
Please Log in or Create an account to join the conversation.
Moderators: solidres