Reputation: 7128
I'm using SMARTY PHP TEMPLATE ENGINE , Apache 2 and PHP 5.3.3 . This was my original main.js file content
// 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;
}
But when i was browsing to my js file (http://domain.com/js/main.js) on browser, it's like this :
(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;}
It's like GZIPPED, something removing newline characters and comment lines . Now i add something to main.js file. Now main.js's original content is this :
// 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'
});
}
});
But when i browse to my main.js file on browser, it's same (there aren't new lines and there aren't newly added content)
(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;}
Same problem for CSS files. Something GZIPing and caching my JS and CSS files. But i couldn't find it. I've tried CTRL + F5
Any ideas ?
NOTE 1
there isn't .htaccess file on /js and /css folders . But there is a .htaccess on root folder.
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>
Note 2
when i browse to main.js?(randomnumbers)
(like main.js?345458
) i can see fresh version . But still there isn't comment lines and new lines.
Upvotes: 0
Views: 160
Reputation: 7128
I noticed, CloudFlare is activated for my domain. And CloudFlare caching / GZIPping my js / css files automatically. I deactivate it and solved my problem.
Thank you.
Upvotes: 0
Reputation: 10665
My guess would be that something like https://developers.google.com/speed/pagespeed/mod is installed on the webserver.
What happens when you request: http://domain.com/js/main.js?cachebuster=somethingrandom to (hopefully) force a really fresh version of main.js?
Update: Reading in the comments that changing the url parameters will give you a fresh version it could very well be a proxy somewhere, either on your own server or somewhere else.
Upvotes: 1