Posts Tagged ‘link’

How to force the browser to reload CSS and JavaScript files

When editing the CSS and JavaScript of a site, there is a slight chance that the user may get the old versions, which at best will cause a lot of complains and at worst will cost you a lot of lost customers. The reason for this is that browsers cache static content like CSS and JavaScript. However, telling a browser to reload them is not that hard to do. All it takes is a little trick that will force our friendly browsers into thinking that the CSS and JavaScript are dynamic content.

Before we go on, let us take a look at how we specify the CSS and JavaScript to be used within HTML. Normally we have something in the line of:

<link rel="StyleSheet" type="text/css" href="/static/style.css">
<script src="/static/js/script.js" type="text/javascript"></script>

Where style.css and script.js are our files. Naturally CSS files are specified with the href attribute of the link tag, while JavaScript files are included using the script tag. Now, let’s take a look how we can make our browser reload CSS and JavaScript every time:

<link rel="StyleSheet" type="text/css" href="/static/style.css?version=15">
<script src="/static/js/script.js?version=15" type="text/javascript"></script>

“Now what is that “version”?”, you are probably thinking. Well it’s nothing. No really, it does absolutely nothing. You can use ?favouritesite=onlinehowto.net15 if you want. It would have the absolutely same effect.

“But what does it do?”, you are probably thinking. “This looks just like passing GET variables.” Exactly!

The browser cache uses a pretty complicated mechanism, but there is one thing that you should know for sure index.html?version=14 and index.html?version=15 are two different pages for the browsers, therefore it can’t rely on its cache, therefore it must get them again. But what happens on the server side? Well those arguments are ignored by our server and it simply supplies style.css and script.js.

Whatever language, technology, etc. you are using, you always keep a header file which is included pretty much everywhere so changing the version=<number> part after each revision is pretty easy. You can even make it a part of your site’s logic.

In conclusion, this trick may save you a lot of headaches related to cached CSS and JavaScript, and if you believe you may have some issues, we greatly encourage you to use it!

VN:F [1.9.18_1163]
Rating: 10.0/10 (2 votes cast)

CSS3 Cascading Principals #3 External Styles

Rounding out our cascading series is the external style sheet; a method that gets its descriptor because it’s not something that will actually be contained within your HTML document, but rather a separate file with the .CSS extension.
There are a couple of reasons you might want to break out your CSS file from your HTML document. For one, it allows you to select multiple style sheets, from which you can pick and choose styles from within your markup; and allows you to create multiple styles that are even further segmented. But perhaps the biggest windfall is that you can apply those style sheets across multiple pages, saving you the effort of having to re-create them in each of your HTML documents. Not only is this a tremendous time saver, but it also cuts down on potential mistakes that might be made across a large project.
Externals style documents also have the least clout in our CSS order-of-importance hierarchy, so if an in-line style or head style addresses an element, they will take precedence.

CSS
Link syntax.
<link rel=”stylesheet” type=”text/css” href=”style.css” />

Before your HTML document can begin pulling styles, however, you’re going to need to tell it where those styles are located. By linking your style sheets, the document knows to treat it as an extension of itself, and when then apply those styles just as if they appeared in the head of the document. Which is why, when we insert a <link> element, we place it in the head of our document. It works as kind of a placeholder for “styles yet to be determined”.
If you have multiple style sheets, you just repeat the process for each .CSS file that you’d like to call. You only need to include .CSS files that you are using for that particular document, and it’s important to make sure that there are no conflicts. If you have different style definitions that are attempting to alter the same element, the last style sheet you link to will be applied.
If you’re ever in the market for some great Windows web hosting, try Server Intellect. We have been very pleased with their services and most importantly, technical support… Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Tips on Symbolic link or symlink in Unix Linux

In this tutorial I have shared my experience with Unix soft links and hard links.I found them extremely useful and have seen its versatile usage in various project.

This UNIX command tutorial is in continuation of my earlier article Top 10 basic networking Commands in Unix and 10 examples of using find command in UNIX if you haven’t read already you may find some useful information based on my experience in Unix and Linux commands.

Though this UNIX command tutorial is dedicated to highlight Differences between soft link in UNIX and hard link in UNIX which is also a very popular UNIX command interview question, I am not able to resist myself by showing you the usage of soft link in UNIX, below are some of example of UNIX symlinks I have seen during my projects of involving UNIX soft links:

1) In our project our Java process picks latest version of package for executing, which is a UNIX soft link. So whenever we do a release we just need to update latest UNIX symlink which makes release seamless and rollback very easy which in tern increases stability and predictability of our Java application.

2) All our UNIX script takes the location as argument so they are agnostic about the absolute path of resources and these resources are provided them via UNIX soft links and environment variables. This feature of our scripts saves a lot of time whenever we need to do any migration which involves changing location of resources.

3) An important point about UNIX soft link is that they inherit the permission of the folder to which they are pointing out.

Now let” see what are differences between Soft Link and Hard Link in UNIX

Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Disable the annoying Sticky Keys popup dialog in Windows 7

The Shift key is widely used in many, many games. Sometimes to get the desired effect in the game you need to tap the Shift key a couple (of dozen) times. And when this happens… You get the annoying
Sticky Keys popup dialog: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.9/10 (11 votes cast)

Disable the annoying Filter Keys popup dialog in Windows 7

Not many people use the right Shift when working. Most people prefer to capitalize letters using the left Shift. But us gamers, we use the right Shift a lot. Sometimes we press it for more than 8 seconds. And I’m sure all of you know what happens then: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.9/10 (11 votes cast)

How to turn games on in Windows 7 Professional Edition

Microsoft had disabled games for Windows Vista Business Edition and Windows Vista Enterprise Edition. And just like them Windows 7 Professional Edition has its games disabled by default. Apparently this was caused by the pressure given from employers, because they believe that their employees will spend their working hours playing Spider Solitaire or something like that. Well, if your office is running Windows 7 Professional, you can be the light of the party by simply knowing how to enable the Games.

First open Control Panel:
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

How to set the download location in Google Chrome

All files downloaded through Google Chrome are placed in a default folder on your PC. However you can modify this so that the files you download are stored in a different location. We will show you how to do just that in a few simple steps. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

How to clear your browsing data in Google Chrome

If someone else shares your PC or your account to your PC with you, you probably don’t want him/her to be able to see what sites you have visited, not to mention being able to log anywhere using your passwords. If you have accidentally saved one of your passwords or you simply want to delete your browsing history, Chrome provides this functionality. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

How to disable auto formatting for hyperlinks in MS Word 2007

Personally, I really hate it when MS Word automatically turns web addresses into hyperlinks. Sure, it is easier to click on a link than to copy it and paste it in the address bar of a given browser. But, it looks really ugly to have a blue hyperlink in the middle of your document. This goes double for contracts and other important documents. So how do we modify this behavior?

First open MS Word options, by pressing the MS Office Button (top-left) and select Word Options:
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

How to remove the clock from the taskbar in Windows 7

Many users like using one of the large varieties of clocks provided by the Windows 7 gadgets. This pretty much renders the clock on the taskbar obsolete. This basically means that we should get rid of it. Well removing it is a matter of a few clicks. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)