网页不加载新版本,只有在清除缓存后

Webpage doesn't load the new version, only after clearing cache

我的网页不会自行加载更新版本,只有在清理缓存后才会加载,并且它正在与所有看过旧版本的计算机一起使用,那些不是一切都很好的,有没有人遇到过任何问题像这样?任何人都知道问题可能出在哪里?代码还是浏览器? chrome 和 firefox 正在改进,safari 一切正常。任何一种想法都会很有帮助。

网站:http://bodygym.lt

@media (min-width: 780px) {
#kainosmobile {display: none !important;}
}

@media screen and (max-width: 1180px) {
.woocommerce ul.products li.product .price {margin-right: 110px !important; float: left !important; margin-top: 15px !important;}
.woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3 {display: block !important; margin-bottom: 0 !important; padding: 0 !important;}
.woocommerce ul.products li.product .button {display: block !important; right: unset !important; left: 80px !important}
}

@media screen and (max-width: 780px) {
#kainos {display: none !important;}
#kainosmobile {display: initial !important;}
.woocommerce ul.products li.product .price {margin-right: 19% !important; float: left !important;margin-top: 15px !important;}
.woocommerce ul.products li.product h3, .woocommerce-page ul.products li.product h3 {display: block !important; margin-bottom: 0 !important; padding: 0 !important;}
.woocommerce ul.products li.product .button {left: 80px !important; right: unset !important;}
}

@media screen and (max-width: 440px) {
div.wpb_wrapper.vc_custom_1469634122179 {padding: 15px !important;}
.woocommerce ul.products li.product .button {left: 30% !important; right: unset !important;}
}

.wtrShtTimeTableEntryName {padding: 0 !important;}
.wtrShtTimeTableItem tbody td {text-align: left !important;}
.wtrShtTimeTableFitnessEntry a {color: #222 !important;}
.wtrShtTimeTableItem .wtrShtTimeTableFrom {text-align: left !important;}
.wtrShtTimeTableEntryTimePeriod {width: 69% !important;}
.wtrShtTimeTableFitnessEntry {background: transparent !important;}
.wtrShtTimeTableEntryTimePeriod {color: #666 !important; font-weight: 400 !important;}
.wtrShtTimeTableEntryName {padding: 0 !important;}
.wtrShtTimeTableFitnessEntry {color: #666 !important; font-weight: 400 !important; border-left: 1px solid #eb4c4c !important; border-radius: 0 !important; padding-left: 7px !important;}


.woocommerce ul.products li.product .price {margin-right: 110px !important;}
.woocommerce ul.products li.product h3 {line-height: 28px !important; font-weight: 400 !important; letter-spacing: 0px !important;}
.woocommerce-Price-amount.amount {font-weight: 400 !important;}
.woocommerce ul.products li.product .button {font-weight: 400 !important; letter-spacing: 2px;}
#abonementas {display: none !important;}
#akcija {color: #ff3a49 !important;}
#galioja {color: #888 !important; font-size: 11px !important;}
#kainos .woocommerce ul.products li.product {margin-bottom: 0 !important; border-radius: 0 !important;}
#kainos div.wtrPageContent.vcRow.wtrNoMargin.clearfix {background: #f9f9f9 !important; margin: 6% 6% 6% 6% !important; padding: 5px !important; border-radius: 10px !important;}
#kainos .vc_custom_1477331591093 {padding: 0 !important;}
#kainos .vc_custom_1477331604701 {padding: 0 !important;}
#kainos div.woocommerce {border-bottom: 1px solid #ededed !important;}

#kainosmobile .woocommerce ul.products li.product {margin-bottom: 0 !important; border-radius: 0 !important;}
#kainosmobile div.wtrPageContent.vcRow.wtrNoMargin.clearfix {background: #f9f9f9 !important; margin: 6% 6% 6% 6% !important; padding: 5px !important; border-radius: 10px !important;}
#kainosmobile .vc_custom_1477331591093 {padding: 0 !important;}
#kainosmobile .vc_custom_1477331604701 {padding: 0 !important;}
#kainosmobile div.woocommerce {border-bottom: 1px solid #ededed !important;}
#kainosmobile div.woocommerce:nth-child(odd) {border-bottom: 0px solid #ededed !important;}
#kainosmobile div.woocommerce:nth-child(8) {border-bottom: 1px solid #ededed !important;}

.wrtAltFontCharacter {font-family: 'raleway' !important;}

虽然在 http://www.bodygym.lt/wp-content/themes/symetrio-theme/style-custom.css?ver=4.6.1

中加载了此代码,但它并未出现在屏幕上

我 运行 在 Magento 站点遇到过类似情况,这是服务器端缓存的问题。我能够通过重新启动缓存服务器来解决问题。我必须联系我的网站托管公司才能让他们重新启动。

用户浏览器将缓存网站资源,包括图像、CSS 文件和JavaScript 文件。为了强制更新,我通过构建自定义模块扩展了 Magento,该模块允许我为合并的 CSS 和 JS 文件指定版本号。每次我对 CSS 进行更改时,我都会增加版本号,这会更改文件名并强制用户浏览器下载新文件。

etc/system.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <sections>
        <dev>
            <groups>
                <js>
                    <fields>
                        <js_files_version translate="label,comment">
                            <label>JavaScript Files Version</label>
                            <comment>Increment this to force browsers to download the latest version, as this will change the filename of the files.</comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </js_files_version>
                    </fields>
                </js>
                <css>
                    <fields>
                        <css_files_version translate="label,comment">
                            <label>CSS Files Version</label>
                            <comment>Increment this to force browsers to download the latest version, as this will change the filename of the files.</comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </css_files_version>
                    </fields>
                </css>
            </groups>
        </dev>
    </sections>
</config>

etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <JustKampers_Core>
            <version>1.0.0</version>
            <depends>
                <Mage_Core />
            </depends>
        </JustKampers_Core>
    </modules>
    <global>
        <models>
            <core>
                <rewrite>
                 <design_package>JustKampers_Core_Model_Design_Package</design_package>
                </rewrite>
            </core>
        </models>
        <blocks>
            <justkampers_core>
                <class>JustKampers_Core_Block</class>
            </justkampers_core>
        </blocks>
        <helpers>
            <core>
                <rewrite>
                    <data>JustKampers_Core_Helper_Data</data>
                </rewrite>
            </core>
        </helpers>
    </global>
</config>

Model/Design/Package.php

<?php

class JustKampers_Core_Model_Design_Package extends Mage_Core_Model_Design_Package
{
    const XML_CONFIG_JS_FILES_VERSION = 'dev/js/js_files_version';
    const XML_CONFIG_CSS_FILES_VERSION = 'dev/css/css_files_version';

    /**
     * Merge specified css files and return URL to the merged file on success
     *
     * @param $files
     * @return string
     */
    public function getMergedCssUrl($files)
    {
        // secure or unsecure
        $isSecure = Mage::app()->getRequest()->isSecure();
        $mergerDir = $isSecure ? 'css_secure' : 'css';
        $targetDir = $this->_initMergerDir($mergerDir);
        if (!$targetDir) {
            return '';
        }

        // base hostname & port
        $baseMediaUrl = Mage::getBaseUrl('media', $isSecure);
        $hostname = parse_url($baseMediaUrl, PHP_URL_HOST);
        $port = parse_url($baseMediaUrl, PHP_URL_PORT);
        if (false === $port) {
            $port = $isSecure ? 443 : 80;
        }

        // versioning
        $version = Mage::getStoreConfig(self::XML_CONFIG_CSS_FILES_VERSION);

        // merge into target file
        $targetFilename = md5(implode(',', $files) . "|{$hostname}|{$port}|{$version}") . '.css';
        $mergeFilesResult = $this->_mergeFiles(
            $files, $targetDir . DS . $targetFilename,
            false,
            array($this, 'beforeMergeCss'),
            'css'
        );
        if ($mergeFilesResult) {
            return $baseMediaUrl . $mergerDir . '/' . $targetFilename;
        }
        return '';
    }

    /**
     * Merge specified javascript files and return URL to the merged file on success
     *
     * @param $files
     * @return string
     */
    public function getMergedJsUrl($files)
    {
        // versioning
        $version = Mage::getStoreConfig(self::XML_CONFIG_JS_FILES_VERSION);

        $targetFilename = md5(implode(',', $files) . "|{$version}") . '.js';
        $targetDir = $this->_initMergerDir('js');
        if (!$targetDir) {
            return '';
        }
        if ($this->_mergeFiles($files, $targetDir . DS . $targetFilename, false, null, 'js')) {
            return Mage::getBaseUrl('media', Mage::app()->getRequest()->isSecure()) . 'js/' . $targetFilename;
        }
        return '';
    }
}