Nick Pyett

Blog tag

3 posts tagged with: browsers

Four Things You Need to Make a Site (Work) in HTML5

Sat, 26th February 2011

tags: browsers, html, css, web standards, javascript

HTML5 Doctype

This site is made with HTML5, but without a few little extras, the styling and layout would break in all except the most up-to-date browsers. For example, in all versions of IE (except IE 9, which is still currently in beta) the CSS applied to new HTML5 tags would not work, and in Firefox 3.6, the layout would not look the same as in Chrome.

Here is a quick list of things you'll need to get around these problems. None of them are hard to apply, and all the really hard work has been done by other people. Bonus!

1. The New Doctype

From the W3C's working draft of HTML5, finally a doctype you can remember! Without the doctype, certain browsers will enter quirks mode (in order to maintain backwards compatibility for pages designed with standards that are not the W3C's) and you have basically no chance of getting you web page to look right.

<!DOCTYPE html>

2. A Tag Reference

Knowledge is power, and so W3Schools HTML5 tag reference is a good place to start. How you interpret which tag is right for which part of your site is more or less up to you, but remember, the tags are to be used to give semantic meaning or context to the information in your page. Some are more obvious to apply than others.

At this point, you site will probably work with Safari, Opera and Chrome. So yeah, none of the big boys. The next two points include code that you can apply to your page, and are included (with loads of other stuff) in the fantastic HTML5 boilerplate, but if you want a simpler solution you can just include them yourself.

3. A CSS Reset

As mentioned before, even Firefox has trouble with HTML5; the new tags are inline elements by default, so applying display: block to them will fix most of the problems. A good CSS reset will do this and more, and is a great base from which to start coding.

4. The HTML5 Shiv

Now you've got your site working in modern browsers, you need to give IE 6-8 a kick up the backside. These versions of IE do not recognise the new tags at all, and will do all sorts of strange things with them (as they would for any other tag they do not recognise). For this site, IE will decide to push all the content out of the header and into the white content section below. Very annoying.

However, if I include Remy Sharp's (and Jon Neal's, with a little help from Sjoerd Visscher) brilliant HTML5 Shiv (or is it shim?), all my troubles are over. What this does is inform your browser that the world has moved on, and that other versions of HTML have come into being. You're basically having to tell a browser how to do its job, and creating the element in the browser's DOM.

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

All done. Now go! Make a site in HTML5! Or HTML. Or whatever the cool kids are calling it these days.

Comment & share »


How to search Google UK from the address bar in Firefox

Wed, 16th June 2010

tags: browsers

Searching using the default Google search from Firefox's address bar will use Google US, but if you want to change this to Google UK, you can use the following method.

You can edit many of the Firefox's preferences by opening Firefox and typing "about:config" (without the quotes) into the address bar. You will then be greeted by a screen that reads "Hear be dragons!". Click the button that reads "I'll be careful, I promise!" (and make sure you are), and the preferences list will appear. As you can see, there are loads. Type "keyword" into the "Filter:" search field at the top of the page and two preferences will be displayed, "keyword.URL" and "keyword.enabled".

http://www.google.co.uk/search?ie=UTF-8&oe=UTF-8&q=

Firstly, copy the line of text above and then double click on the "keyword.URL" preference. A pop-up box titled "Enter string value" will appear. Paste the text into the input field and click "OK". Next, if the text in the "Value" column of the second preference "keyword.enabled" reads "false", double click on the preference to change it to "true". This will allow the search keyword we just set to be used. With this setting set to "false", any search in the address bar will take you to the closest URL to your search term. You may like this functionality, but the sites you will be taken to will only be in relation to the URL, not in relation to any search engine page-rank or site quality.

Close the "about:config" tab or Firefox itself to close the preferences menu. Other resources on Firefox include my blog post How to view your Firefox bookmarks in a tab and MozillaZine's About:config entries article.

Comment & share »


How to view your Firefox bookmarks in a tab

Fri, 14th May 2010

tags: browsers

There are many great add-ons for Firefox (the open-source web browser from Mozilla), some of which allow you to open your bookmarks in a formatted tab. Both Bookmarks Tab and MyBookmarks do this, but if you want something even simpler, copy and paste the following line into Firefox's address bar.

chrome://browser/content/bookmarks/bookmarksPanel.xul

Easy! If you want to be even craftier, you can bookmark the address, right click, choose "Properties", check the box that says "Load this bookmark in the sidebar" and click "Save". You now have a bookmark that will open all your bookmarks as normal when you left-click, or open in them in a new tab when you Ctrl+click or middle-click, just like opening a normal tab window.

Other great Firefox resources include the Basic Bookmarks add-on, a jimmyrcom YouTube tutorial showing you how to speed the browser up with about:config and LifeHacker's guide to FF3.

Comment & share »