I have a website hosted on IIS to do some testing. However whenever I change the html files in the website directory and referesh the webpage in my browser (chrome), nothing changes. Do I have to force the server to update and see the new changes, or is there something else?
I think that's not server related problem. (Of course you can try to restart server, or system if nothing helps)
Try followings
Clean your cookies, browsing history.
Then force refresh the page by hitting F5 / CTRL+F5 / CTRL+R.
Check with another browser
AFAIK you don't need to force any IIS reset or anything of that kind. As the other comments and answers already suggested something else is probably going on:
browser cache
perhaps IIS is not serving the files you're changing (a duplicate perhaps)
... etc
Try some Rubber Duck Debugging to find the problem, helped me out more than once with this kind of "This should just work, why doesn't it?" problem.
I've been using IIS for over a decade and it is very good about recognizing changes in your content and serving the latest. You don't have to refresh it. Some files like web.config or global.asa are special and when they are changed IIS will automatically restart the site for you.
Mime types like html, txt, gif, and jpeg are assumed by proxies and browsers to be very static and are cached aggressively in those layers (vs asp, jsp, etc).
This superuser question talks about refreshing in Chrome -- apparently its not always simple.
If, however, you want to give IIS a kick the easiest way is with the command line:
iisreset
I doubt it will fix your problem but it might make you feel better :)
This could be the browser cache (And yes! sometime Chrome is too smart). As you can see people answer here, their solutions can help. However, I would like to point possible problems of each solution and give my favorite solution.
clean browser history: no one like it, pretty annoy that you have to clean verytime.
force refresh by f5 or ctrl +f5: sometime this does not work.
check with another broswer: you can face the same problem when you do another change.
My favorite solution is that if your url is 'http://localhost/page1.html', you can call as 'http://localhost/page1.html?fake=xxxxx'. The xxxx can be any thing. You can change it anything you want. This solution fakes different urls for brosers but actually it is not different.
Related
In my situation, a wordpress install, we use the core enqueue functionality for styles and scripts, and the version number parameter which adds a GET param after the filename, for cache busting. We bump this on changes to the linked file, as per normal. This is all well and good and technically working.
My issue is that our host sets an expires header for html files for 10 days, so the html ends up in the browser cache. The html includes the link tag, which includes the old version number, which means that they get the old CSS/JS.
When we encounter this in testing, we just Ctrl-Shift-R and all is well, but I would prefer not to be asking our user's to clear their cache everytime we make a change.
My 'Nuke it from Orbit' solution would be to ask them to not cache html, but this seems like a Bad Idea(tm). Is there a good method for busting the browser HTML cache from our end? I feel like this should be a common issue and a solved problem, but maybe I'm just googling the wrong terms here because everything I have seen so far is basically - change the URL's; which seems even more of an extreme solution (Take that, accumulated SEO Ranking!)
This is a general question but i didn't found any satisfactory answer of this.I am creating a website with 7-8 pages.I have a common css which is being used in all the pages.When i go to my homepage this css gets loaded.Now when i go to some other page,would this css get loaded again from server or from browser local cache?
I read somewhere that you have to make some changes in server's .htaccess file for enabling the browser cache.Does browser itself doesn't use the cached files? I would be hosting the website first time so i have no idea of this stuff.Please guide so that i can make a site with better performance.
It depends on the caching policy enforced by the web server/ Most goods ones will only deliver it once and that may be over multiple visits to your site. Perhaps look at the HTTP headers to find out. Firebug can do this for you
I think this depends on the browser settings. I do notice in chrome I sometimes need to empty the cache. You can also specify it to cache. I am not exactly sure how, but you can look up application caching.
I may be wrong by saying it is my users browser but i have a question when updating my online store.
I have recently redesigned my homepage store which i am currently in the middle of completing.
It can be found through http://www.hot-water-cylinders.com/
Bascially, i realized going through a computer that had already been to the website and stored it in its cache everything was out of place, the image files linked into the document where the old ones use and basically clearing my browsers data was the only way of fixing the layout,
My question is that will my returning visitors have to deal with this issue too, like having to clear their cache and is the anyway to prevent this?
Thanks,
Kieren.
This is how HTTP caching is supposed to work.
The best way to avoid this is to make the resource URL:s unique. If you're doing all of this manually try putting the new resources in a versioned folder (/2.0/css, /2.0/img, etc).
At first, yes, but the browser cache usually least for only a day. If you want to prevent any cache you need to add a version to your style request as below
<link rel="stylesheet" href="path/to/my/css/mystyle.css?v=1">
The v parameter is relative to your css version, when you upload a new style version you'll need to change the version.
Let's assume there's a site - http://domain.com
Now my job is to upload a CMS (Joomla, version 1.7). However, there's a big mess on FTP - already a Joomla (version 1.5), forum software, many unknown PHP files, many custom folders.
I can't simply upload Joomla 1.7, because I would have to delete that Joomla 1.5 file by file. So I've decided to upload CMS to subdomain, http://domain.com/subdomain, and display that content from http://domain.com. I don't want to simply redirect, because original URL must be kept.
How to do it? iframes are pretty outdated.
Iframes ? Stay away, use rewrite rules and keep the domain clean
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
iFrames are still heavily used today and would be a fine solution for you. However there would be some problems with using an iframe that you should consider. My two cents fix the problem correctly by install Joomla properly, then try the using re-write rules all else fails you can use iframes.
Bad Points for iframe solution:
Using an iframe pointing to your site would probably be really bad for SEO. I don't think google or bing would look into the iframe thus you'd get 0 SEO value out of this solution.
URL link's would be ruined, if a user wanted to bookmark, tweet the url,
or even just send it to a friend they would have no way of doing that
because the url would be changing in the iframe not in the browser
bar.
No so bad points for iframes:
Sounds like this is an easy workaround for your problem so its not very time consuming.
iFrames are used all over the place on the internet and are fully supported by all major browsers.
I've noticed an issue while developing my pages that's always bothered me: while Firefox (my general "dev" browser) always updates CSS and images when they change on the server, Internet Explorer does not always do this. Usually, I need to refresh the page in IE before it will ask the server for updated versions of things.
As I understand it, isn't the browser supposed to at least check the timestamps on all server side objects for each request, and then update them client side as necessary? Is there a way I can... not force, but.. "encourage" the browser to do this for certain items?
The main issue I'm having here is that I have some JavaScript on my pages that relies on the CSS being initialized a certain way, and vice versa. When one updates and the other does not (very common in IE when both are in their own external pages) it causes confusion, and occasional splatter results on the page. I can handle doing the "refresh the page" dance on my own for deving, but I don't want to have to encourage my users to "refresh the page or else" when I'm going on a scripting spree on the site.
Any advice would be greatly appreciated. The page itself updates without a hitch (it's PHP), so worst case scenario I could just spit the CSS and JavaScript out into the page itself, but that's really really ugly and of course I'm trying to avoid it at all costs.
It's a good practice to design your site so that the client only needs to fetch external JavaScript and CSS once.
Set up external resources to expire 1 year in the future. Append a version number to each file name, so instead of "style.css", use "style-1.2.4.css" and then when you want to update the client's CSS, increment the version number.
Incrementing the version number forces the client to download the updated file because it is seen as a totally separate resource.
Add a little random query string at the end of all URLs. It's ugly but it works when developing. For example:
<link rel="stylesheet" type="text/css" href="/mycss.css?foo=<?php echo rand(); ?>"/>
You can do the same for scripts, background images, etc. (And don't forget to remove these things when your site goes live ;))
This is only an issue during development, when the files are changing frequently. Once you've published the site, visitors will get the current version, and the caching mechanisms will do more or less what you want.
Rather than modify how my sites work, I have simply developed the habit of clearing my cache before refreshes during development. In Firefox, as you said, this is not usually an issue, but if I need to be really sure, I use Shift+Ctrl+Del, Enter (and my Clear Private Data settings leave only "Cache" checked.) And on IE, there's the old Shift+F5.
Of course, as others have mentioned, a random query string on your volatile files can save you a few keystrokes. But understand that this is in fact just for your own convenience and not really necessary for the production site.
It's better if you put the last-change timestamp as GET-data at the end of the source - in this way you'll be sure that there wont be any cache errors.
It's just dumb to remove the cache completely since it will result in slower pages.
If you're using apache, in your .htaccess for that css file:
<FilesMatch "mycssfile\.css$">
Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0"
Header set Expires: 0
Header set Pragma: no-cache
</FilesMatch>
Browsers store pages in the internal cache usually according to the instructions your server tells them. No, they are not required to reload the files if they appear to be unexpired based on the last check. Of course, when you hit reload, they do explicitly reload main page, but their behavior with respect to js and styles may differ.
I develop with Safari which has Develop -> Disable Caches menu for exactly that reason. I'm sure Firefox has something similar.
I use a slight twist on DanHerbert's method. I tend to use the same names for the stylesheets, but I affix a version number in the query string so that the browser sees the files as different whenever one chooses to incriment the version. Things still will get cached, but you can invalidate it at your choosing.
It's a bit cleaner than changing filenames and lends itself to being a centrally managed solution, especially in complex apps with lots of scripts and stylesheets coming from the four winds.