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

时间:2016-10-26 08:58:56

标签: css html5 webpage

我的网页本身并没有加载续订版本,只有在清理了缓存之后才能加载所有已经看过旧版本的计算机,那些并不是一切都很好,有任何人面对这样的事情?任何人都知道问题可能在哪里?代码还是浏览器?它有镀铬和火狐,一切都很好的野生动物园。任何想法都会非常有用。

网站: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

2 个答案:

答案 0 :(得分:0)

我遇到了与Magento网站类似的情况,这是服务器端缓存的问题。我能够通过重新启动缓存服务器来解决问题。我不得不联系我的网站托管公司,让他们重新启动。

答案 1 :(得分:0)

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

等/的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>

等/ 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>

型号/设计/ 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 '';
    }
}

enter image description here