我使用PHP模板Smarty ENGINE,的Apache 2和PHP 5.3.3。這是我原來的main.js文件內容東西gzip壓縮和緩存我的JS和CSS文件
// Functions
(function($){
var url1 = /(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,
url2 = /(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,
linkifyThis = function() {
var childNodes = this.childNodes,
i = childNodes.length;
while(i--)
{
var n = childNodes[i];
if (n.nodeType == 3) {
var html = $.trim(n.nodeValue);
if (html)
{
html = html.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(url1, '$1<a href="http://$2" target="_blank">$2</a>$3')
.replace(url2, '$1<a href="$2" target="_blank">$2</a>$5');
$(n).after(html).remove();
}
}
else if (n.nodeType == 1 && !/^(a|button|textarea)$/i.test(n.tagName)) {
linkifyThis.call(n);
}
}
};
$.fn.linkify = function() {
return this.each(linkifyThis);
};
})(jQuery);
function openCenteredWindow(url, height, width, name, parms) {
var left = Math.floor((screen.width - width)/2);
var top = Math.floor((screen.height - height)/2);
var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
if (parms) { winParms += "," + parms; }
var win = window.open(url, name, winParms);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
return win;
}
但是,當我在瀏覽器中瀏覽到我的js文件(http://domain.com/js/main.js),是這樣的:
(function($){var url1=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,url2=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,linkifyThis=function(){var childNodes=this.childNodes,i=childNodes.length;while(i--)
{var n=childNodes[i];if(n.nodeType==3){var html=$.trim(n.nodeValue);if(html)
{html=html.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(url1,'$1<a href="http://$2" target="_blank">$2</a>$3').replace(url2,'$1<a href="$2" target="_blank">$2</a>$5');$(n).after(html).remove();}}
else if(n.nodeType==1&&!/^(a|button|textarea)$/i.test(n.tagName)){linkifyThis.call(n);}}};$.fn.linkify=function(){return this.each(linkifyThis);};})(jQuery);function openCenteredWindow(url,height,width,name,parms){var left=Math.floor((screen.width- width)/2);var top=Math.floor((screen.height- height)/2);var winParms="top="+ top+",left="+ left+",height="+ height+",width="+ width;if(parms){winParms+=","+ parms;}
var win=window.open(url,name,winParms);if(parseInt(navigator.appVersion)>=4){win.window.focus();}
return win;}
這就像GZIPPED,刪除換行符和註釋行。現在我添加一些東西到main.js文件。現在main.js的原創內容是這樣的:
// Functions
(function($){
var url1 = /(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,
url2 = /(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,
linkifyThis = function() {
var childNodes = this.childNodes,
i = childNodes.length;
while(i--)
{
var n = childNodes[i];
if (n.nodeType == 3) {
var html = $.trim(n.nodeValue);
if (html)
{
html = html.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(url1, '$1<a href="http://$2" target="_blank">$2</a>$3')
.replace(url2, '$1<a href="$2" target="_blank">$2</a>$5');
$(n).after(html).remove();
}
}
else if (n.nodeType == 1 && !/^(a|button|textarea)$/i.test(n.tagName)) {
linkifyThis.call(n);
}
}
};
$.fn.linkify = function() {
return this.each(linkifyThis);
};
})(jQuery);
function openCenteredWindow(url, height, width, name, parms) {
var left = Math.floor((screen.width - width)/2);
var top = Math.floor((screen.height - height)/2);
var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
if (parms) { winParms += "," + parms; }
var win = window.open(url, name, winParms);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
return win;
}
$(document).ready({
/*
-webkit-border-bottom-left-radius: 0px !important;
-moz-border-radius-bottomleft: 0px !important;
border-bottom-left-radius: 0px !important;
*/
/* dropdown sub-menu control
***************************/
var leftItemSub = $('.loginbarLeftItem').find('ul');
var rightItemSub = $('.loginbarRightItem').find('ul');
if(leftItemSub.length){
leftItemSub.parent().css({
'-webkit-border-bottom-left-radius': '10px !important',
'-moz-border-radius-bottomleft': '10px !important',
'border-bottom-left-radius': '10px !important'
});
}
if(rightItemSub.length){
rightItemSub.parent().css({
'-webkit-border-bottom-left-radius': '10px !important',
'-moz-border-radius-bottomleft': '10px !important',
'border-bottom-left-radius': '10px !important'
});
}
});
但是,當我瀏覽到我的main.js在瀏覽器文件,這是相同的(有沒有新的生產線,而且沒有新添加內容)
(function($){var url1=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,url2=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,linkifyThis=function(){var childNodes=this.childNodes,i=childNodes.length;while(i--)
{var n=childNodes[i];if(n.nodeType==3){var html=$.trim(n.nodeValue);if(html)
{html=html.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(url1,'$1<a href="http://$2" target="_blank">$2</a>$3').replace(url2,'$1<a href="$2" target="_blank">$2</a>$5');$(n).after(html).remove();}}
else if(n.nodeType==1&&!/^(a|button|textarea)$/i.test(n.tagName)){linkifyThis.call(n);}}};$.fn.linkify=function(){return this.each(linkifyThis);};})(jQuery);function openCenteredWindow(url,height,width,name,parms){var left=Math.floor((screen.width- width)/2);var top=Math.floor((screen.height- height)/2);var winParms="top="+ top+",left="+ left+",height="+ height+",width="+ width;if(parms){winParms+=","+ parms;}
var win=window.open(url,name,winParms);if(parseInt(navigator.appVersion)>=4){win.window.focus();}
return win;}
CSS文件的問題相同。 GZIPing和緩存我的JS和CSS文件的東西。但我找不到它。我試過CTRL + F5
有什麼建議嗎?
注1:
沒有在/ js和/ CSS文件夾的.htaccess文件。但是在根文件夾中有一個.htaccess。
options -multiviews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^users$ users.php
RewriteRule ^categories/([^/.]+)?$ cat.php?cid=$1&%{QUERY_STRING}
RewriteRule ^user/([^/.]+)?$ user.php?uname=$1&%{QUERY_STRING}
RewriteRule ^tags/([^/.]+)/([^/.]+)?$ tags.php?cid=$1&tag=$2&%{QUERY_STRING}
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]*)?$ view.php?title=$1&id=$2&%{QUERY_STRING}
</IfModule>
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
注2
當我瀏覽到main.js?(randomnumbers)
(like main.js?345458
)我可以看到新版本。但仍然沒有評論線和新線。
您可能正在使用框架來構建您的網站,請將其添加到您的問題中,並且還包括您的主機類型是Apache? –
@SimonGroenewolt,我沒有使用框架。我正在使用** Smarty **。另外我使用** Apache **。(我將它們添加到我的問題中) – Eray
請在'/ js'或'/'文件夾中查找'.htaccess'文件。請注意,它可能是默認隱藏的,所以你需要告訴你的文件GUI顯示隱藏文件。發佈內容,如果有的話。 – pixelistik