Google Chrome contains many features that can be harnessed by webmasters to deliver a better end-user experience. Google Chrome comes with Gears built in, which allows webmasters to take advantage of APIs, such as offline storage. In addition, Google Chrome allows your web application to look and feel like a "desktop" application, as users can launch Google Chrome in a mode with a minimalist UI, featuring nothing but a title bar.
Google Chrome also uses a brand-new JavaScript engine (V8), which is much faster than existing JavaScript interpreters. This means that you can create more complex and more intensive AJAX applications with fewer speed and processing constraints. Finally, Google Chrome is built on top of WebKit, so Google Chrome users will benefit from the CSS3 features being added to WebKit as those features are released.
There are a number of other browsers to choose from. Find out about some of the more widely used browsers at the websites listed below:
Google Chrome's user agent string is:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13.
Google Chrome uses the WebKit rendering engine, which is shared by other browsers such as Apple's Safari. Web pages should look the same in Google Chrome as they will in these other WebKit-based browsers. You can look for webkit in user-agent strings to target these browsers, rather than a specific browser name (such as Google Chrome or Safari).
To help browsers render your content correctly, you should always provide content and character-encoding information at the top of your document's source. If you're using frames or iframes, specify the encoding at the top of the source of those frames as well. Some browsers (including Google Chrome) won't recognise encoding declarations that appear deep in a document (such as after CSS or script in your document's head section).
Example of good encoding placement:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<script type="text/javascript">
... your JavaScript code ...
</script>
.......
In addition, make sure that your web server is not sending conflicting HTTP headers. Headers sent by the web server will override any charset declarations in your page.
Google Chrome doesn't read encoding information that's declared with document.write(). If you're using this method to declare encoding in iframes, for example, you may see garbled characters when the iframe is rendered. Instead of:
frame1.js
document.write("<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">"); ... other JavaScript code ...
...we recommend the following:
frame1.html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <script type="text/javascript"> ... your JavaScript code ... </script> ...
Google Chrome percentage-encodes query parameters within a URL. Make sure that your server-side scripts are properly decoding percentage-encoded characters before processing the data.
You should specify an NPAPI version of the plug-in.
ActiveX is only supported by Internet Explorer (and browsers built on top of Internet Explorer) on Windows. Google Chrome, Mozilla Firefox, Apple Safari and others do not support ActiveX. Instead, these browsers make use of the Netscape Plug-in Application Programming Interface (NPAPI).
There are a couple of ways to view JavaScript errors and work to debug them in Google Chrome:
help at the debugger command line to get started.Google Chrome uses a different rendering engine from Internet Explorer, so it may display web pages differently. Apple Safari uses the same rendering engine as Google Chrome (WebKit) and should display pages in the same way.
There are several tools to help you test your website in Google Chrome:
Make sure that your external style sheets are being served with the correct charset and content type. They should be served as text/css or text/css;charset=X.
It's better not to specify charset for a style sheet in the HTTP header; instead, add the declaration to the very beginning (no preceding characters, including spaces and line breaks) of your CSS style sheet, as follows:
@charset "xxx"
Neglecting to specify encoding information could prevent your style sheet from being properly parsed.
To learn more about this topic, please visit the World Wide Web Consortium's documentation at http://www.w3.org/TR/CSS21/syndata.html#charset.
Google Chrome's default behaviour is to minimise and then display only the title bar of pop-ups in the lower-right section of the browser window. Users can view a pop-up's content by dragging its title bar into a more visible position. This allows pop-ups to be loaded, so as not to break the functionality of sites which depend on them. It also prevents undesired pop-ups from covering the page and distracting users.
This indicates a problem with the use of SSL on the page. Clicking the exclamation mark in Google Chrome will provide more details about the issue. Often, issues are the result of mixed content on your page – for example, your top-level web page is served over HTTPS and is protected via SSL, but you have also included elements on the page (such as images, script or CSS) via HTTP. All content must be served over HTTPS in order for the lock to be displayed.
The Google Chrome team plans to support the HTML5 database API, as well as the other APIs that WebKit supports, including offline and workers, in a future release.
Google Chrome users can create shortcuts for any web page by selecting Create application shortcuts from the Page menu icon. By default, new shortcuts take the title and favicon of the page to which the shortcut is pointing.
You can specify the title, description and URL of Google Chrome shortcuts that point to your page by inserting specific meta tags in your document's <head> section.
| To customise: | Tag | Example |
|---|---|---|
| The shortcut title | application-name | <meta name="application-name" content="Gmail"/> |
| The description (used when more space is available, such as in the preferences panel) | description | <meta name="description" content="Google's approach to email"/> |
| The URL to be opened when the shortcut is clicked | application-url | <meta name="application-url" content="http://www.mail.google.com"/> |
| The shortcut icon | <link rel="icon" href="gmail_32x32.png" sizes="32x32"/> |
For example:
<head>
<meta name="application-name" content="Google Mail"/>
<meta name="description" content="Google's approach to email"/>
<meta name="application-url" content="http://www.mail.google.com"/>
<link rel="icon" href=gmail_32x32.png sizes="32x32"/>
<link rel="icon" href=gmail_48x48.png sizes="48x48"/>
</head>
These tags closely match those of the Gears Desktop API. Please refer to the Gears Desktop API documentation for more details.
Google Chrome has a multi-process architecture, meaning that tabs can run in separate processes from each other and from the main browser process. New tabs spawned from a web page, however, are usually opened in the same process, so that the original page can access the new tab using JavaScript.
However, Google Chrome will look for hints to open new tabs in a separate process, if you are navigating the new tab to a different website.
The easiest approach is to use a link to a different website that targets a new window without passing on referrer information. Google Chrome recognises this as a hint to keep the new page isolated from the original page and it will load the new page in a separate process. For example:
<a href="http://differentsite.com" target="_blank" rel="noreferrer">Open in new tab and new process</a>
If you want the new tab to open in a new process while still passing on referrer information, you can use the following steps in JavaScript:
opener variable to null, so that it can't access the original page.For example:
var w = window.open(); w.opener = null; w.document.location = "http://differentsite.com/index.html";
These hints only work for URLs that are on a different domain or protocol from the page spawning the pop-up. For example, if the page spawning the pop-up is on http://www.example.com/:
If a Google Chrome user has enabled the "Chrome Instant" feature, most web pages will load as soon as the URL has been typed into the address bar, before the user hits Enter.
If you are a website administrator, you can prevent Google Chrome from exhibiting this behaviour on your website:
X-Purpose: instant
HTTP 403 ("Forbidden") status code.When a user enters a single word into the address bar, Google Chrome performs a search for the term and returns results using the user's default search engine. At the same time, Google Chrome issues a HEAD request for http://term, to see if it's a valid website. If Google Chrome receives an HTTP/2xx response (such as HTTP/200 OK), the user will be asked if they want to visit the site instead. Clicking through to the site from the prompt will set the website as the default target for that term for future requests.
Google Chrome will also display the prompt if it receives:
You should make sure that your web server responds properly to HEAD requests and not just GET requests for a page.
For example, if a site exists at http://project.intranet.example.co.uk and a user within that corporate network enters project into the address bar:
Users can override the default (search) behaviour by entering project/ or http://project, or by selecting the address bar entry that reads project/ instead of Search for project.
By providing an OpenSearch description document (OSDD), you enable Google Chrome to include your site in the list of search engines in the browser. For more information about OpenSearch, please visit http://www.opensearch.org.