<!-- Add JQuery from googles CDN -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!-- If it doesn't load, load it locally -->
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<!-- Then your custom JS -->
<script src="/js/main.js"></script>
Category Archives: HTML
prevent caching of files
Version them in their with their timestamp. This way, when they change, the link will change and the browser will reload the sitemap… Otherwise it will be fine to be cached as it wont have changed.
URL rewriting – WordPress style
Add this into your .htaccess file…
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
English Ordinals for dates in PHP
Displaying the day-part of the date, followed by the month etc. just looks plain wrong and lazy – ’20 September 2009′. ’20th’ would look much nicer and can be achieved without too much hard work. A simple function…
Continue reading
Catching a keyPress..
…like ‘Enter’ for instance.
Print a Page, or Print a Section
This is another functionality that I have been looking or for a while. I haven’t tried it yet, but intend to add this to my default toolbox! I am sticking it here for now – and will update this when I have used it.
Cross-browser bookmark link
‘Bookmark Me’ is a sort of IE thing and doesn’t usually work in FireFox, Safari, Chrome, etc.. so as a FireFox user I’ve never bothered with a bookmark links before.
FireFox users know that Ctrl+D is the shortcut for these browsers, and that most ‘Bookmark Me’ links just aren’t work clicking – as they won’t work.
And then I found this…
Flickering images inside <a>’s
In IE6 and sometimes in IE7 the background images flicker if they’re also an <a>. A small edition to .htaccess overrides the browsers default to load the backgrounds every time.
Custom Error redirects with .htaccess
Cold hard website errors are horrible and unnecessary. All you need is a few nice looking .html files in your directory somewhere, then use .htaccess to reditrect to these when there is an error. Obviously, no errors at all would be better…. 🙂
Continue reading
Detecting a mobile browser
I have often looked at my sites on my mobile. Some look good, others look really bad – usually down to some clever fancy-arse stuff that wouldn’t even work on a mobile.
So, I have finally found this article that reckons it is sussed. I’m gonna try it out.
Continue reading