2010-09-10 | AMB首頁

Archive

2010年4月 的Archive

The Importance of Cross Browser Compatibility: Tips and Resources

2010年4月30日
回應關閉
Advertisement in The Importance of Cross Browser Compatibility: Tips and Resources
 in The Importance of Cross Browser Compatibility: Tips and Resources  in The Importance of Cross Browser Compatibility: Tips and Resources  in The Importance of Cross Browser Compatibility: Tips and Resources

By Sean Geng

Nowadays everyone’s using a different browser. Between popular options like Firefox, Safari, Chrome and Internet Explorer, which make up close to 98% of the internet market share of browsers, and the other little known browsers like Konqueror, there are a multitude of browsers being used to view your site.

How does your website function across all these options? It’s important that your website is usable across all major media, whether it be popular browsers, mobile devices, or any other web browsing devices. In this article, we’ll cover some basics of making sure your site is cross-browser-compatible, including snippets and resources to help you along the way.

The Problem

Not everyone uses the same browser. Similar to how everyone is running on a different operating system, you can’t expect all people to be using the same web browsing tool.

So what are the options? The data about current browser share varies depending on the source and the region, but in general, Internet Explorer, Firefox, Chrome, Safari, and Opera make up most of the market share, with Internet Explorer dominating the market. Internet Explorer 8 has over 25% market share, Internet Explorer 6 has 215 and Internet Explorer 7 having 14%.

When there are so many different options out there, each running their own rendering engine, how do you ensure that your web design or application will hold up in each of them? That what we hope to cover and provide solutions for in this article.

How does your site perform?

So, how does your current site perform in the multitude of browsers that are out there? Why not check for yourself? If you don’t want to install all the major browsers out there on your own personal machine, here are some resources to help you out.

Adobe Browser Lab
Adobe Browserlab offers an awesome solution for viewing on demand screenshots of your site. This is usually my go-to program for testing in various browsers.

Browserlab in The Importance of Cross Browser Compatibility: Tips and Resources

Browsershots
Makes screenshots of your web design in a lot of different browsers. After you submit your URL, it gives you a url where your screenshots will be loaded up.

Browsershots in The Importance of Cross Browser Compatibility: Tips and Resources

Browser Sandbox
Runs an application to view your site in a variety of browsers.

Browsersandbox in The Importance of Cross Browser Compatibility: Tips and Resources

Browsrcamp
Allows you to test the compatibility of your design with Mac OS X browsers.

Browsrcamp in The Importance of Cross Browser Compatibility: Tips and Resources

IE Tester
A free WebBrowser that allows you to check how your site looks like on IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP.

Ietester in The Importance of Cross Browser Compatibility: Tips and Resources

Browser Proofing Your Site

So turns out your site doesn’t function as expected across all the major browsers? Don’t worry. It happens to the best of us. Now it’s time to go about fixing it.

Validate

First off, validate your site. Ironing out those XHTML and CSS errors can often solve those pesky browser bugs. I suggest running your site through W3’s XHTML Validator and CSS Validator.

CSS Reset

Another great way to ensure your site is cross browser compatible is to always reset your CSS before working on a project. There are many different global CSS resets, but Eric Meyer’s one and Yahoo’s one are considered to be the most correct ones:

Eric Meyer’s Reset Reloaded

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        font-weight: inherit;
        font-style: inherit;
        font-size: 100%;
        font-family: inherit;
        vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
        outline: 0;
}
body {
        line-height: 1;
        color: black;
        background: white;
}
ol, ul {
        list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
        border-collapse: separate;
        border-spacing: 0;
}
caption, th, td {
        text-align: left;
        font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
        content: "";
}
blockquote, q {
        quotes: "" "";
}

YUI’s CSS Reset

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
        margin:0;
        padding:0;
}
table {
        border-collapse:collapse;
        border-spacing:0;
}
fieldset,img {
        border:0;
}
address,caption,cite,code,dfn,em,strong,th,var {
        font-style:normal;
        font-weight:normal;
}
ol,ul {
        list-style:none;
}
caption,th {
        text-align:left;
}
h1,h2,h3,h4,h5,h6 {
        font-size:100%;
        font-weight:normal;
}
q:before,q:after {
        content:'';
}
abbr,acronym { border:0;}

Either include thet CSS reset styling at the top of your stylesheet, or have Yahoo host it and simply link to it in your HTML-documents, right before your own stylesheet:

<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">

Conditional Statements

Another popular method of ensuring your site is cross-browser-compatible is targeting specific browsers using conditional statements. Basically, the idea is to detect the user’s browser, and if it is one of those specified, it should perform a certain action.

One of the most common uses of conditional statements is to include a stylesheet if the browser is Internet Explorer. By doing this, you can correct some bugs that exist in your code and override your current stylesheet.

To use conditional statements, simply include the statement in the head section of your XHTML, right below the stylesheet inclusion.

Include a stylesheet if the browser is IE

<!--[if IE]>
        <link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]-->

Target Specfic Versions of IE

<!--[if IE6]>
        <link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]-->

(Of course, you can replace IE6 with any version of IE)

PHP Browser Detect

If you are looking for a more specific way of targeting browsers and even operating systems, then you should consider checking out Techpattern’s PHP Browser Detection Script. It’s a very powerful script that will detect everything from your visitor’s operating system, browser, JavaScript support, screen resolution, and more.

Phpbrowserdetect in The Importance of Cross Browser Compatibility: Tips and Resources

jQuery Browser Detection

For a jQuery-based solution of detecting browsers and adding a corresponding class to the body of your site, check out TVI Design’s Browser Detection using jQuery. The script adds a class to the body, which you can then style in CSS.

Mobile Devices

Things are changing. New devices are emerging as a medium for browsing the web these days. Whether it’d be smartphones, iPods or an iPad, there is a new enviornment for web design and as they become increasingly popular, it means that you must also take them into consideration when designing a site.

What does my site look like in a mobile device?

How about testing your site in some web based mobile emulators? If you are looking to test your design in a mobile device, here are some great resources:

Test iPhone
Simulator for quickly testing your iPhone web applications

Testiphone in The Importance of Cross Browser Compatibility: Tips and Resources

iPhoney
iPhoney is a free application you can download in order to simulate a iPhone browsing experience. Includes support for rotating, zooming, and even turning off plugins like Flash.

Iphoney in The Importance of Cross Browser Compatibility: Tips and Resources

MobiReady
Excellent tool for testing in mobile devices. Provides feedback including test results, options, and emulators.

Mobiready in The Importance of Cross Browser Compatibility: Tips and Resources

Mobile Device Emulator
A great way to test your site across a multitude of mobile devices.

Dotmobi in The Importance of Cross Browser Compatibility: Tips and Resources

 

Ways to make your site mobile friendly

So how do you go about making your site mobile friendly? Well, if you are interested in pursuing a mobile version of your site, here are a few ways of doing so.

Redirect Users on a Mobile Device
An easy way of making sure your site is mobile-friendly is to redirect users viewing it from a mobile device to a certain “plain” version of the page on your server. Some of the easiest ways of doing this include Studio Hyperset’s Mobile Redirect Script, or using Mobiforge’s Lightweight Device Detection in PHP.

Mobify
Mobify allows you to design a mobile version of your site based on your current design. It also allows for traffic stats and advertising options.

Mobify in The Importance of Cross Browser Compatibility: Tips and Resources

Mofuse
Mofuse lets you create a mobile version of your blog for free. It’s pretty easy, and only takes a bit of time.

Mofuse in The Importance of Cross Browser Compatibility: Tips and Resources

Further Resources

Still hungry for cross browser compatibility resources and solutions?

About the author

Sean Geng is a freelance web designer based in Pittsburgh, PA. He is the site curator over at Designmess, a online community for designers and developers. You can follow him on Twitter, or contact him via his website.

noupe

Create a Social Media Sharing Menu Using CSS and jQuery

2010年4月30日
回應關閉

Social Media Sharing Menu Using CSS and jQuery

In this tutorial, we will show you how to create a social media share menu using CSS and jQuery. We are going to create the menu using basics CSS such as the CSS background-position property and a little jQuery to make the links animated.

Final Result

Click on the image below to view the live demo.

Final Result

Create the HTML

1 Let’s create the HTML first. Here is our markup.

<div id="social_nav_horizontal">
  <h3> Bookmark or Share This Post </h3>
  <ul>
    <li><a class="delicious" href="http://del.icio.us/post?url=Your website title" title="Bookmark on del.icio.us">Delicious</a>
    <li><a class="facebook" href="http://www.facebook.com/sharer.php?u=http://yourwebsite.com"  title="Share this on Facebook" >Facebook</a></li>
    <li><a class="stumbleupon" href="http://www.stumbleupon.com/submit? url=http://www.yoursite.com/" title="Stumble This Page" > Stumble</a></li>
    <li><a class="twitter" href="http://twitter.com/home?status=Your Website Title- http://yourwebsite.com@TwitterUserName" title="Tweet This Page" >Twitter</a></li>
  </ul>
</div>

Style the HTML with CSS

This is how our menu looks without any CSS.

Notice that there is a CSS class added to each link in our HTML. For example: delicious, facebook, and so on. We use different classes so that we can give the links their own icons on the left (more on this later).

2 We will make the list items display side by side by using the float property. Also, we have added some padding to the link elements (#social_nav_horizontal ul li a), including 28px padding on the left so that when we add the background, there is enough space for the social media icons.

#social_nav_horizontal {
  margin-left: 100px;
  font-family: Futura, Verdana, Sans-Serif;
  font-size: 18px;
  color: #8e9090;
}
#social_nav_horizontal h3 {
  display:inline;
  padding: 0px 10px;
  border-bottom:dashed 1px #ccc;
}
#social_nav_horizontal ul {
  margin: 0;
  padding: 0;
  margin-top:20px;
}
#social_nav_horizontal ul li {
  float: left;
  padding: 5px 0 0 5px;
  margin-left: 5px;
  list-style-type: none;
}
#social_nav_horizontal ul li a {
  padding: 4px 0 0 28px;
  height: 32px;
  color: #999;
  text-decoration: none;
  line-height: 1.45em;
}

Here’s how our menu looks with the above CSS style declarations.

3 After that, we add the CSS background to each class. You can use your own social media icon sets or check out the Freebies section here on Six Revisions to find free social media icons. Note that you will have to adjust the background-position and the left padding of #social_nav_horizontal ul li a depending on the sizes of the social media icons you use.

Here is the CSS for the first social media link (Delicious).

.delicious {
  background:url(images/delicious.png) no-repeat;
  background-position:0px -1px;
}

Here is the visual representation of this code:

This is how the Delicious icon should display:

4 We add a CSS declaration for each of the social media links.

.delicious {
  background:url(images/delicious.png) no-repeat;
  background-position:0px -1px;
}
.facebook {
  background:url(images/facebook.png) no-repeat;
  background-position:0px -1px;
}
.stumbleupon {
  background:url(images/stumbleupon.png) no-repeat;
  background-position:0px -1px;
}
.twitter {
  background:url(images/twitter.png) no-repeat;
  background-position:0px -1px;
}

If everything is right, here is how it should look.

Another version: Vertical menu

So, if you want to create a CSS only menu, you’re done.

But now, we are going to add a little jQuery and change the menu’s orientation to spice it up a little. This one will be vertical menu.

5 I just took off the CSS float property from the list item declaration (#social_nav_horizontal ul li) to covert it to a vertical menu.

Add animation effects with jQuery

Time to add some jQuery. First, do not forget to add the jQuery library to your HTML page (here’s a guide for that, if you’re not familiar with jQuery).

We will be adding an effect that nudges the link to the right when the user hovers over it.

6 In the first line of our jQuery script, we select the elements we want to apply the effect to: #social_nav_horizontal ul li a.

We apply an event listener method, .hover, which will listen to the event that the user hovers over (and out of) a link item. We feed the .hover method the functions we want to execute when the user hovers over a link item (first function), and also when they hover out of the link (second function).

We use the .animate method on the hovered-over element to move them to the right by modifying its margin-left CSS property.

We also use the .stop method before the .animate method to prevent the animation from queuing it up. Basically, the .stop method will stop any other ongoing animation events on $(this) element.

$(document).ready(function() {
  $('#social_nav_vertical li a').hover(
  // on mouse over move to left
  function() {
    $(this).stop().animate({ marginLeft: '20px' },300);
  },
  // on mouse out, move back to original position
  function() {
    $(this).stop().animate({ marginLeft: '0px' }, 300);
  });
});

Here is how it looks when someone mouses over a link.

You can check out the demo to see it working.

Wrap up

That’s it! Please feel free to add any suggestions to improve this in the comments.

Download Source Files

Related Content

About the Author

Kawsar Ali is a web designer, graphic designer, and photographer based in NY, U.S. He’s also the founder of Desizntech, a site to find tips about web design, Mac, PC and more. If you’d like to connect with him, you can follow him on Twitter and check out his Personal Website.

Six Revisions

Open Source Media Player in jQuery & HTML5

2010年4月30日
回應關閉

The mediafront platform is an open source (GPLv3) front end media solution for the web. Through its integration with popular content management systems, it employs an innovative and intuitive interface that allows any website administrator to completely customize the front end media experience for their users without writing any code.

In addition to this amazing module included is the OSM (Open Standard Media Player) Player. This media player is open source (GPL) media player that is built to dynamically deliver any type of web media, including HTML5, YouTube, Vimeo, and Flash.

open-video-player

Requirements: jQuery Framework
Demo: http://www.mediafront.org/project/osmplayer
License: MIT License

Sponsors

Pixmac: Stock Photos, Royalty Free Pictures and Images

Webappers

Favorite Mobile Apps of RWW Staff

2010年4月30日
回應關閉

Every now and then we publish the favorite mobile apps or sites of the ReadWriteWeb staff. The last time we did this was November 2009, however with our Mobile Summit just around the corner we wanted to give you an updated list. We’re all early adopters of mobile technology here at ReadWriteWeb, so have a scan of our favorite apps and see what catches your eye.

We’d also love to know your current favorites, because that’s a great way to keep our finger on the pulse. Please note your favorite mobile apps or sites in the comments.

Sponsor

Join us at the ReadWriteWeb Mobile Summit on May 7, in Mountain View, CA, to discuss the hottest mobile apps and the latest mobile trends. If you’re in town for the Web 2.0 Expo that week, our Mobile Summit is the day after. We’d love to see you there! Register here.

Richard MacManus (iPhone)

  • ReadWriteWeb iPhone App (of course)
  • Diamedic
  • Evernote
  • Insight (Basecamp app)
  • Google Voice
  • Google Reader
  • Shazam
  • Facebook
  • Tweetie
  • Woopra
  • Flicks (movies)
  • Art
  • Words With Friends
  • WorldMate
  • NYTimes
  • The Onion

Marshall Kirkpatrick

  • Facebook
  • Portland Business Journal
  • Cinch
  • Gowalla
  • Tweetie
  • NYT
  • WSJ
  • Rachel Maddow
  • Yelp
  • Pandora
  • SimpleMindX (mind mapping)
  • AroundMe
  • Instapaper
  • Shazam
  • AppsFire
  • BaseBall ‘10
  • Etsy Addict
  • Newser
  • Crop For Free
  • The Guardian
  • Plancast
  • Mobile Safari

    Mobile web apps: Techmeme, MediaGazer, Quora, EveryBlock

Sarah Perez

iPhone:

  • Google Reader (web app)
  • Facebook
  • WeatherBug
  • Flashlight
  • Tweetie
  • Brizzly
  • TweetDeck
  • Siri
  • Flickr
  • Bump
  • Phone Flicks
  • Pandora
  • Foursquare (why am I doing this?)
  • WhiteNoise (baby app)
  • Instapaper
  • NYT
  • Yelp
  • Google Maps
  • Amazon
  • Babies R Us
  • Notifications
  • iScrobble

iPad:

  • Google Reader (web app)
  • NYT
  • BBC
  • NPR
  • USA Today
  • Netflix
  • AP News
  • ABC Player
  • Instapaper
  • Pandora
  • Twitterific
  • StreamToMe
  • Facebook (web shortcut! no app!)
  • Desktop
  • iMahjong

Frederic Lardinois

  • Instapaper
  • Reeder
  • Gowalla
  • Tweetie
  • WorldMate
  • Boxcar
  • PicPosterous
  • NYTimes

Mike Melanson (iPhone)

  • Facebook
  • Tweetdeck
  • Evernote
  • Public Radio
  • Gowalla
  • Google Maps
  • Boxcar
  • MapMyRide (when I’m out riding)
  • Pandora
  • ReadItLater

Alex Williams

  • Pandora
  • Twitdroid
  • Facebook
  • Google Maps
  • The Hangover ("for weekend mindless laughs with the teenage son.")

Chris Cameron

  • Social: Foursquare, Tweetie, Facebook.
  • Games: Words With Friends & Charadium.
  • Photography: AutoStitch, TiltShiftGen & ColorSplash.
  • Other: TripIt & Chipotle.

    And the RWW app of course!! (Actually I use it every day to share my stories on Twitter/Facebook easily).

Audrey Watters

I like mobile apps that allow me to move easily between iphone and laptop, so Evernote and RememberTheMilk.

Also Marvel and ComiXology’s comics apps. And the Kindle app for when I need words to go with my picture books. :)

Abraham Hyatt

Goodreads, Stanza, Thompson Reuters, ReadItLater, NYT, Echofon, CameraPlus, Words With Friends, RWW, Pandora

Sean Ammirati

Twitterific, RWW App, Encamp, Kindle, Zipcar App

Elyssa Pallai

Where’s Wally – entertainment for children of every age.

Jared Smith ("The Lone Blackberrier")

  • Twitter for BlackBerry official app–direct message push via the BlackBerry system is an awful nice touch
  • Seesmic for BlackBerry–fills a big gap in the official Twitter client by letting me support multiple accounts; probably the program that’s easiest on my resources aside from the official client
  • MyKite–still my go-to to check in on Brightkite on BlackBerry
  • Rowmote (I use it on an iPod touch)–extremely inexpensive and powerful alternative to the Apple Remote for controlling a Mac.
  • RadarScope (on iPod touch)–still the best mobile radar viewer on any platform.

See also: POLL: Which Location-Based Mobile App Do You Use Now?

Discuss


ReadWriteWeb

Mendeley Throws Open the Doors to Academic Data

2010年4月30日
回應關閉

mendeleylogo.jpgInnovations in communications software and websites can be quite exciting. After the dust dies down, however, it’s really not clear how much more information has been made available, how much more people can communicate, how much more thinking has been enabled.

London-based Mendeley’s offering up an Open API and making a vast catalog of academic publications searchable, well, that might make the cut.

Sponsor

Mendeley is a popular academic and scientific research cross-platform management tool, usable both desktop and online. The tool automatically extracts bibliographic data from a user’s document library and stores that information, and the papers and studies it helps builds, on their computer or on the cloud. It is that information that is now available with its API and on its search.

Prior to making the API catch-as-catch-can, Mendeley is asking researchers and developers to send in proposals by May 14 and will announce who among them will have immediate access on May 21.

The quantities of data in aggregate (the API also offers you your own data) and the varieties in type of research, from cancer studies to the influence of the Iroquois Confederacy on early American democracy, beggars the imagination. On a more practical level, Jason Hoyt, the company’s Research Director, writing on the Mendeley blog, pointed out the number of features that company gets requests for are too many to handle. Perhaps developers, both general and niche, will invent some interesting tools.

The catalog has basic search starting today, but Hoyt said the company already has an advanced search function ready that will be implemented in two weeks.

mendeleyfeed.jpgHoyt promises the relational elements of Mendeley will be expressed in its search results.

“An algorithm called ‘ReaderRank’…will adjust results based on the level of readership for an article. This doesn’t mean the most read articles will always appear at the top, only that it is an additional measure in ranking your results. We have also taken care to prevent artificial enhancement of the results, i.e. gaming the readership. Over time, we hope to refine this algorithm by taking into account other measures of quality such as the reputation of who you trust and follow on Mendeley.”

Although the combination of Open API and search should in itself be a powerful source of information, inside academe and out, it might also inspire academic publishers, who are notorious stingy with information, to loosen their stranglehold on knowledge.

Discuss


ReadWriteWeb