Tag Archives: name

Glossary: Guerilla Marketing

guerilla marketing

Guerrilla marketing is a form of marketing that utilizes unconventional tactics to get maximum results when promoting a business or service. As the name suggests, this style of marketing relies heavily upon surprise, creativity and shock and awe tactics. Thus, large quantities of money are not necessarily required to perform guerrilla marketing — making it an ideal strategy for startups, small businesses and enterprises alike. It’s a much more personal form of marketing and tends to humanize even the largest of brands. Regardless of the size of your company, a little excitement and buzz surrounding your brand can always be…

The post Glossary: Guerilla Marketing appeared first on The Daily Egg.

Source article: 

Glossary: Guerilla Marketing

Official Feature Release: Crazy Egg Recordings

Crazy Egg Recordings

Today we are releasing our newest feature – Recordings. And as the name suggests, Crazy Egg users can now view video recordings of their website visitors’ sessions. Just to be clear, Recordings doesn’t record visitors through their computer cameras :). We record their screen activity as they navigate and use your website. Here’s an example: We’ve been very excited about this release. Many of our customers have been asking for this functionality, and it was our pleasure to build it for them! We really wanted to make sure we built a visitor recording feature that serves our customer base in…

The post Official Feature Release: Crazy Egg Recordings appeared first on The Daily Egg.

See the article here:

Official Feature Release: Crazy Egg Recordings

The Top 10 Most Common AdWords Mistakes (And How To Fix Them)

Top 10 Google Adwords Mistakes

AdWords can be an incredibly powerful platform for growing your business, but the truth is that most businesses are wasting thousands of dollars every month due to poor account management. If you feel like you could be generating more revenue from AdWords, chances are that you’re making some of these ten common mistakes that are inhibiting your performance. In this post I will be showing you ten common AdWords mistakes that I’ve seen literally hundreds of advertisers make. And, more importantly, I’m going to show you exactly how to fix them, so you can take next steps towards creating an…

The post The Top 10 Most Common AdWords Mistakes (And How To Fix Them) appeared first on The Daily Egg.

Excerpt from – 

The Top 10 Most Common AdWords Mistakes (And How To Fix Them)

How to Create the Perfect Website A/B Test

The concept of perfection is an interesting one. Like infinity, it represents something that can never truly exist, yet most of us talk about it as if it does. How often have you heard a friend or coworker say they don’t want to put their name on anything that is not “perfect”? 40 years ago, Nadia Comaneci became the first gymnast to score a perfect “10” in an Olympic gymnastics event, breaking the paradigm that perfection was unattainable. Is it possible to create perfection in our website testing? For the athlete, achieving perfection is all about maximizing the output of…

The post How to Create the Perfect Website A/B Test appeared first on The Daily Egg.

Taken from: 

How to Create the Perfect Website A/B Test

Thumbnail

How to Create Engaging Content (Even If You’re a Terrible Writer)

You might think that you’re incapable of effective content marketing, because you don’t have the chops for great writing. Think again. Sure, you might not be the next John Donne, but that doesn’t mean that you can’t fill up your blog with great articles that reel in visitors. Content marketing works. Even if you suck at writing. But how does it work? Here are some ways that you can create engaging content even if you’re a terrible writer. 1. First, Break All the Rules Yes, that’s the name of a famous book, but the principle in the title applies here…

The post How to Create Engaging Content (Even If You’re a Terrible Writer) appeared first on The Daily Egg.

Visit site – 

How to Create Engaging Content (Even If You’re a Terrible Writer)

Free Photoshop Tools For Web Designers

Photoshop is still a favorite among a lot of web designers, and the right tools make it even more powerful than it already is. To help you boost productivity, save time and (obviously) nerves, we have picked some valuable Photoshop resources, plugins and scripts for you.
Some of them will speed up routine tasks so you can concentrate more on your actual work, others build a bridge between Photoshop and code so your design mockups can benefit from the best of both worlds.

Read more – 

Free Photoshop Tools For Web Designers

A Foolproof Method for Creating Content That Converts

create-amazing-content-650
Get to work on your next content masterpiece. Image source.

When your content is mediocre, it’s nearly impossible to get people to pay attention.

But when your content is amazing, it’s easy to promote it. It’s easy to drive traffic. And it’s much easier to pull in qualified leads.

To create amazing content, we’re going to steal a technique from Brian Dean.

It’s called the Skyscraper Technique, and it’s based around creating content so valuable that it “towers” above your competitor’s content – hence the name.

This is what gives your content a competitive edge, making it easier to get social shares and backlinks.

The technique involves three main steps:

  1. Find content that’s already proven to get social shares and backlinks
  2. Publish content that’s better than anything else out there on that topic
  3. Promote it to drive traffic and capture leads.

Simple enough? Let’s break it down.

1. Find content that is proven to perform well

To find content that is tried-and-true, we’re going to start with a tool called Buzzsumo.

Buzzsumo is a search engine that finds the most highly shared content for any given search term. It even provides the exact number of shares per article on each of the major social media networks.

Here’s an example:

If I do a search for “landing page design”…

Buzzsumo 1

… Buzzsumo pulls up all of the landing page design articles with the most social shares:

Buzzsumo 2
Buzzsumo 3

If the most shared articles on a topic have a lot of social shares (in the ballpark of 500+), that topic is proven to be popular. This means that if you create a piece of content on that topic, it’s already predestined to get social shares.

So here’s what you’re going to do:

First, do a search on Buzzsumo for a topic you would like to write about. If the top articles have received a good amount of social shares, make a list of the most shared articles and read through each one.

As you’re reading, jot down two things:

  1. The information that is mentioned over and over again in each article. This is standard information on the topic. Therefore, it should not be left out of your content, otherwise your content will be incomplete.
  2. The crucial information that most of the articles are not addressing or are only touching on. This is one of the components that will set your content apart.

I prefer to keep track of this in a spreadsheet, like so:

Spreadsheet 1 2

Then gather data from Topsy

Next, we’re going to use another useful tool called Topsy.

Topsy is a search engine that shows you all of the top tweets for a given search term. You can also filter your searches by influencers, links, tweets, photos and videos.

Topsy 1

For example, if I do a search for “landing page design,” Topsy pulls up the top tweets within a specific date range:

Topsy 2

You’ll want to use Topsy to find all of the tweets related to your keyword. Then, you’ll want to see which related articles influencers are tweeting about. To do this, get another spreadsheet ready:

Spreadsheet 2

Search for articles that are getting a ton of tweets. Then, filter your search by “Influencers” to see what people with the largest social media followings are tweeting about. To do this:

  1. Use the sidebar option to filter by influencers.
Topsy 3
  1. Then click on the “Mentions” link below each influencer to see what content they’re sharing.
Topsy 4 Paint
  1. Grab those URLs as well, and jot down which influencers are sharing this content.
  2. Next, follow the same steps you did with the articles you found using Buzzsumo. Take note of 1) the information that’s mentioned over and over again and 2) the crucial information that is being left out or neglected.

Then grab some data from good ol’ Google

Finally, we want to find content that is proven to get backlinks and rank in Google. Get a third spreadsheet ready for this step and then:

  1. Type your keyword into Google and grab the URLs of the top 10-20 search results (skip Wikipedia pages and such).
  2. Plug each URL into a backlink checker, like Ahrefs or SEO Spyglass. Copy-paste each URL that has received a good amount of backlinks into your spreadsheet.

    Depending on your niche, this threshold could be over 10 backlinks – or it could be over 50. You can’t say without looking at it relatively. Look at how many backlinks the top ranking articles are getting, and compare those numbers to the lower ranking articles. This will give you an idea of what an impressive number of backlinks looks like.

  3. Lastly, go through each one and take note of the same two pieces of information you did with the previous articles.

And what are you left with?

By now, you know which types of articles are proven to get social shares, backlinks and rank in search engines.

But you also know:

  • What information must be included
  • Which information will set your content apart
  • What content the most influential people/companies are sharing on this topic (and who they are!)

Not bad. But now it’s time to make your content better than anything else out there.

2. Create amazing content that’s better than the rest

Since you read through all of the most shared articles, you have intimate knowledge of the best content on your chosen subject.

Now it’s time to make your content better. Your goal should be to create the number one resource for this information.

How do you do this?

Well, you have a number of options:

  1. Make it longer. As long as you’re making every word count, more information = more value. Longer content also gives off a higher perceived value, because it has a “wow factor” that makes people more likely to share it. For example, if most of the current articles give 5-10 tips, include 15-20 tips in your article, and you could induce that “wow factor.”

    In terms of ranking in Google, this study found that at least 1,500 words is a good starting point for ranking on the first page (and thus receiving more backlinks).

  2. Make it actionable. Think of your article as a dinner recipe. Give people step-by-step instructions on how to accomplish what you’re teaching.

    Link to tools and credible sources that will help them out. Give them everything they need to master the topic at hand. The more tangible value people get out of your content, the more likely they’ll be to share it on social media.

  3. Make it visual. Include screenshots, diagrams, pictures, and videos to help explain your topic. Not only does this make your content more useful, it can increase its perceived value as well.
  4. Make it user-friendly. Consider user experience as you create your content. Include in-text navigation links so people can jump from one section to another. Create a table of contents at the beginning of your content and a link within each section that brings people back to the top of the page. (Here’s a nifty guide for including in-text links.)

All of these things provide added value on top of the information you’re teaching people.

This makes your content more shareable and more linkable. And what do shares and links get you?

That’s right!

Traffic, subscribers and leads.

3. Promote your content to get social shares and drive traffic

Now that you’ve got so much awesome content, it’s time to push it out into the world. Here are four traffic generation channels you can try:

  1. Twitter
  2. Forum marketing
  3. Quora
  4. BuzzBundle

(Tactics for using these channels for lead gen are broken down – in detail – in my previous Unbounce article, A Step-by-Step Guide to Generating Leads with Your Content.)

These strategies will help you generate consistent traffic with your content. However, if you want big bursts of traffic, you need a little muscle play.

Now, if you don’t have a large social media following, email list, or high-powered connections, it can be tough to make this happen.

The solution is to harness the followings of other people, even if you don’t have a personal connection with them. All you need to do is reach out to social media influencers in your space and ask them to share your content with their followers.

I know. You’re not the asking type right? You’re used to making things happen under your own control? I’m the same way. But you’ve got to suck up your pride and nurture some humility, because you absolutely don’t want to miss out on the results this can bring you.

Reach out to influencers you’ve mentioned in the past

If you have included additional sources in your content, you’ve likely mentioned and linked to some of these influencers already.

Here’s an example from one of my articles:

Content Promotion 1

Go back through your content and find more places to naturally feature other influencers. These mentions are going to be your ticket into the influencer’s inbox.

Next, pull together a list of influencers to contact about your content, starting with the people you’ve already mentioned.

Send them an email that goes something like this:

Hi [NAME],

I’m new to the internet business world, but I’ve learned a lot through your writing.

I’m venturing out on my own now, and I’ve started a blog/business as a content marketer. I love writing about this stuff, and I just wanted to throw my latest article your way. It’s an in-depth tutorial on lead generation:

http://YOURWEBSITE.com/YOUR-CONTENT

I mentioned [COMPANY] in the first tactic, and used your ebooks and internet marketing course as an example of a high value giveaway people should aim for.

If you think people could learn a lot from it, and if you have a second, would you mind sharing the article for me?

If not, no worries. I’m just trying to get it in front of people’s eyes, and hopefully, give them an actionable guide to help grow their businesses.

Anyway, thanks for all of the great content you’ve put out. You’ve given me an amazing foundation to help me build my business.

Have a good one,

Michael

This is the exact copy of an email I sent out to an influencer a while back (minus the capitalized words), and they ended up sharing my content:

Content Promotion 2

This person has over 170,000 followers.

Reach out to your Topsy influencer list too

Then, pull out the influencer list you created from Topsy, and send an email to these people, mentioning that:

  1. You like what they’re doing
  2. You noticed they shared a specific article
  3. You just created a similar piece of content you think they might enjoy, and would they mind sharing it if they have the time?

However, don’t think that just because you ask, an influencer will share your content.

In general, the following criteria should hold true:

  • Your content should be related to their area of interest
  • You should have expressed genuine interest in who they are and what they do. You’re not just trying to use them
  • Your content should be extremely valuable, because by sharing your content, they’re saying that it’s good enough for them to endorse. If it’s not good enough, they won’t endorse it

That’s why it’s so important to create amazing content. No matter how nice your email is, if the content doesn’t deliver, they won’t share it.

I suggest going through a similar process every time you create content that’s intended to drive traffic and generate leads.

The overall quality of your content will skyrocket, and so will your traffic, subscribers and leads.

How to create content that improves lives

Content is such a powerful marketing asset because of the impact it makes in people’s lives.

When you help someone solve their problems for free, they associate you with the solution. You become the one that helped them out when they needed it. In their minds, you’re the person or business who shared the secrets of your profession with them – for nothing in return. That’s a valuable gift.

That’s when people start to see you as a teacher rather than a business – and your content’s immense value starts doing the marketing for you.

People are naturally skeptical of businesses and their motives. But people trust teachers. The more valuable your content, the more they will trust you. And they won’t just trust you. They will trust the quality of your products and services.

So, how do you create content that improves lives, while achieving the business goals you’re striving for?

You genuinely care about the people your business serves. Cultivate a drive to genuinely help them solve their problems. This becomes your first and foremost goal. It becomes your purpose. Not money. Not sales. Not traffic, leads, or subscribers. But rather, a genuine caring for helping out the people your business serves.

And with the tactics and strategies you have learned here, the rest will fall into place.

After all, content isn’t just a marketing asset. It’s a way to improve lives.

Read this article – 

A Foolproof Method for Creating Content That Converts

Thumbnail

Accessibility APIs: A Key To Web Accessibility

Web accessibility is about people. Successful web accessibility is about anticipating the different needs of all sorts of people, understanding your fellow web users and the different ways they consume information, empathizing with them and their sense of what is convenient and what frustratingly unnecessary barriers you could help them to avoid.

Armed with this understanding, accessibility becomes a cold, hard technical challenge. A firm grasp of the technology is paramount to making informed decisions about accessible design.

How do assistive technologies present a web application to make it accessible for their users? Where do they get the information they need? One of the keys is a technology known as the accessibility API (or accessibility application programming interface, to use its full formal title).

Reading The Screen

To understand the role of an accessibility API in making Web applications accessible, it helps to know a bit about how assistive technologies provide access to applications and how that has evolved over time.

A World of Text

With the text-based DOS operating system, the characters on the screen and the cursor position were held in a screen buffer in the computer’s memory. Assistive technologies could obtain this information by reading directly from the screen buffer or by intercepting signals being sent to a monitor. The information could then be manipulated — for example, magnified or converted into an alternative format such as synthetic speech.

Getting Graphic

The arrival of graphical interfaces such as OS/2, Mac OS and Windows meant that key information about what was on the screen could no longer be simply read from a buffer. Everything was now drawn on screen as a picture, including pictures of text. So, assistive technologies on those platforms had to find a new way to obtain information from the interface.

They dealt with this by intercepting the drawing calls sent to the graphics engine and using that information to create an alternate off-screen version of the interface. As applications made drawing calls through the graphics engine to draw text, carets, text highlights, drop-down windows and so on, information about the appearance of objects on the screen could be captured and stored in a database called an off-screen model. That model could be read by screen readers or used by screen magnifiers to zoom in on the user’s current point of focus within the interface. Rich Schwerdtfeger’s seminal 1991 article in Byte, “Making the GUI Talk1,” describes the then-emerging paradigm in detail.

Off-Screen Models

Recognizing the objects in this off-screen model was done through heuristic analysis. For example, the operating system might issue instructions to draw a rectangle on screen, with a border and some shapes inside it that represent text. A human might look at that object (in the context of other information on screen) and correctly deduce it is a button. The heuristics required for an assistive technology to make the same deduction are actually very complex, which causes some problems.

To inform a user about an object, an assistive technology would try to determine what the object is by looking for identifying information. For example, in a Windows application, the screen reader might present the Window Class name of an object. The assistive technology would also try to obtain information about the state of an object by the way it is drawn — for example, tracking highlighting might help deduce when an object has been selected. This works when an object’s role or state can easily be determined, but in many cases the relevant information is unclear, ambiguous or not available programmatically.

This reverse engineering of information is both fallible and restrictive. An assistive technology could implement support for a new feature only once it had been introduced into the operating system or application. An object might not convey useful information, and in any case it took some time to identify it, develop the heuristics needed to support it and then ship a new version of the screen reader. This created a delay between the introduction of new features and assistive technology’s ability to support it.

The off-screen model needs to shadow the graphics engine, but the engines don’t make this easy. The off-screen model has to independently calculate things like white-space management and alignment coordination, and errors would almost inevitably mount up. These errors could result in anomalies in the information conveyed to assistive technology users or in garbage buildup and memory leaks that lead to crashes.

Accessibility APIs

From the late 1990s, operating system accessibility APIs were introduced as a more reliable way to pass information to assistive technologies. Instead of applying complex heuristics to determine what an on-screen object might be, assistive technologies could query the accessibility API for specific information about each object. Authors could now provide the necessary information about an application in a form that they knew assistive technology would understand.

An accessibility API represents objects in a user interface, exposing information about each object within the application. Typically, there are several pieces of information for an object, including:

  • its role (for example, it might be a button, an application window or an image);
  • a name that identifies it within the interface (if there is a visible label like text on a button, this will typically be its name, but it could be encoded directly in the object);
  • its state or current condition (for example, a checkbox might currently be selected, partially selected or not selected).

The first platform accessibility API, Microsoft Active Accessibility (MSAA), was made available in a 1997 update to Windows 95. MSAA provided information about the role and state of objects and some of their properties. But it gave no access to things like text formatting, and the relationships between objects in the interface were difficult or impossible to determine.

In 1998, IBM and Sun Microsystems built a cross-platform accessibility API for Java. Java Swing 1.0 gave access to rich text information, relationships, tables, hyperlinks and more. The Java Jive screen reader, built on this platform, was the first time a screen reader’s information about the components of a user interface included role, state and associated properties, as well as rich text formatting details.

Notably, Java Jive was written by three developers in roughly five months; developing a screen reader through an off-screen model typically took several years.

Accessibility APIs Go Mainstream

In 2001 the Assistive Technology Service Provider Interface (AT-SPI) for Linux was released, based on the work done on Java, and in 2002 Apple included the NSAccessibility protocol with Mac OS X (10.2 Jaguar).

Meanwhile on Windows, the situation was getting complicated. Microsoft shipped the User Interface Automation (UIA) API as part of Windows 7, while IBM released IAccessible2 as an open standard for Windows and Linux, again evolved from the work done on Java.

Accessibility APIs existed for mobile platforms before touchscreen smartphones became dominant, but in 2009 Apple added the UI Accessibility API to iOS 3, and Android 1.6 (Donut) shipped with the Accessibility Framework.

By the beginning of 2015, Chrome OS stood out as the most mainstream platform lacking a standard accessibility API. But Google was beta testing its Automation API, intended to fill that gap in the platform.

Modern Accessibility APIs

In modern accessibility APIs, user interfaces are represented as a hierarchical tree. For example, an application window would contain several objects, the first of which might be a menu bar. The menu bar would contain a number of menus, each of which contains a number of menu items, and so on. The accessibility API describes an object’s relationship to other objects to provide context. For example, a radio button would probably be one “sibling” within a group.

Other features such as information about text formatting, applicable headers for content sections or table cells and things such as event notifications have all become commonplace in modern accessibility APIs.

Assistive technologies now make standard method calls to the operating system to get information about the objects on the screen. This is far more reliable, and far more efficient, than intercepting low-level operating system messages and trying to deconstruct them into something meaningful.

From The Web To The Accessibility API

In browsers, the platform accessibility API is used both to make information about the browser itself available to assistive technologies and to expose information about the currently rendered content.

Browsers typically support one or more of the available accessibility APIs for the platform they’re running on. For example, on Windows, Firefox, Chrome, Opera and Yandex support MSAA/IAccessible and IAccessible2, while Internet Explorer supports MSAA/IAccessible and UIAExpress. Safari and Chrome support NSAccessibility on OS X and UIAccessibility on iOS.

The browser uses the HTML DOM, along with further information derived from CSS, to generate an accessibility tree hierarchy of the content it is displaying, and it passes that information to the platform accessibility API. Information such as the role, name and state of each object in the content, as well as how it relates to other objects in the content, can then be queried by assistive technologies.

Let’s see how this works with some HTML:

<p><img src="mc.png" alt="My cat" longdesc="meeow.html">Rocks!</p>

We have an image, rendered as part of a paragraph. A browser exposes several pieces of information about the image to the accessibility API:

  1. It has a role of “image” (or “graphic” — details vary between platforms). This is implicitly determined from the fact that it is an HTML img element.
  2. Its name is “My cat”. For images, the name is typically derived from the alt attribute.
  3. A description is available on request, at the URL meeow.html (at the same “base” as the image).
  4. The parent is a paragraph element, with a role of “text.”
  5. The image has a “sibling” in the same container, the text node “Rocks!”

An assistive technology would query the accessibility API for this information, which it would present so the user can interact with it. For example, a screen reader might announce, “Graphic: My cat. Description available.”

(Does a cat picture need a full description? Perhaps not, but try explaining that to people who really want to tell you just how amazing and talented their feline friends actually are — or those of their readers who want to know all about what this cat looks like! Meanwhile, the philistines among us can ignore the extra information.)

Roles

Most HTML elements have what are called “roles,” which are a way of describing elements. If you are familiar with WAI-ARIA, you will be aware of the role attribute, which sets a role explicitly. Most elements already have implicit roles, however, which go along with the element type. For example:

  • <ul> and <ol> have “list” as implicit role,
  • <a> has “link” or “hyperlink” as implicit role,
  • <body> has “document” as implicit role.

These role mappings are being standardized and documented in the W3C’s “HTML Accessibility API Mappings2” specification.

Names

While roles are typically derived from the type of HTML element, the name (sometimes referred to as the “accessible name”) of an object often comes from one of several different sources. In the case of a form field, the name is usually taken from the label associated with the field:

<input type="radio" id="tequila" name="drinks" checked>
<label for="tequila">Reposado</label>

In this example, a button has the “radio button” role. Its accessible name will be “Reposado,” the text content of the label element. So, when a speech-recognition tool is instructed to “Click Radio button Reposado,” it can target the correct object within the interface.

The checked attribute indicates the state of the button, so that a screen reader can announce “Radio button Reposado Checked” or allow a user to navigate directly between the checked options in order to rapidly review a form that contains multiple sets of radio buttons.

Authors have an important role to play, providing the key information that assistive technologies need. If authors don’t do the “right thing,” assistive technologies must look in other places to try to get an accessible name — if there is no label, then a title or some text content might be near the radio button, or its relationship to other elements might help the user through context.

It is important to note that authors should not rely on an assistive technology’s ability to do this, because it is generally unreliable. It is a “repair” strategy that gives assistive technology users some chance of using a poorly authored page or website, such as the following:

<p>How good is reposado?<br>
<!--BAD CODE EXAMPLE: DON'T DO THIS-->
<input type="radio" id="fantastic" name="reposado" checked >
<label for="reposado">Fantastic</label><br>
<input type="radio" id="notBad" name="tequila"><br>
<input type="radio" id="meh" name="tequila" title="meh"> Meh

Faced with this case, a screen reader might provide information such as “second of three options,” based on information that the browser provides to the accessibility API about the form. Little else can be determined reliably from the code, though.

Nothing in the code associates the question with the set of radio buttons, and nothing informs the browser of what the accessible name for the first two buttons should be. The for and id attributes of the <label> and <input> for the first button do not share a common value, and nothing associates the nearby text content with the second button. The browser could use the title of the third button as an accessible name, but it duplicates the nearby text and unnecessarily bloats the code.

A well-authored version of this would use the fieldset element to group the radio buttons and use a legend element to associate the question with the group. Each of the buttons would also have a properly associated label.

<fieldset><legend>How good is reposado?</legend>
<!-- THIS IS A BETTER WAY TO CODE THE EXAMPLE -->
<input type="radio" id="fantastic" name="reposado" checked>
<label for="fantastic">Fantastic</label><br>
<input type="radio" id="notBad" name="reposado">
<label for="notBad">Not bad</label><br>
<input type="radio" id="meh" name="reposado">
<label for="meh">Meh</label><br>
</fieldset>

Making this information available through the accessibility API is more efficient and less prone to error than relying on assistive technologies to create an off-screen model or guess at the information they need.

Conclusion

Today’s technologies — operating systems, browsers and assistive technologies — work together to extract accessibility information from a web interface and appropriately present it to the user. If appropriate content semantics are not available, then assistive technologies will use old and unreliable techniques to make the interface usable.

The value of accessibility APIs is in allowing the operating system, browser and assistive technology to efficiently and reliably give users the information they need. It is now easy to make an interface developed with well-written HTML, CSS and JavaScript very accessible and usable for assistive technology users. A big part of accessibility is, therefore, an easily met responsibility of web developers: Know your job, use your tools well, and many pieces will fall into place as if by magic.

With thanks to Rich Schwerdtfeger, Steve Faulkner and Dominic Mazzoni.

(hp, al, ml)

Footnotes

  1. 1 http://www.paciellogroup.com/blog/2015/01/making-the-gui-talk-1991-by-rich-schwerdtfeger/
  2. 2 http://rawgit.com/w3c/aria/master/html-aam/html-aam.html

The post Accessibility APIs: A Key To Web Accessibility appeared first on Smashing Magazine.

Visit link:

Accessibility APIs: A Key To Web Accessibility

Thumbnail

Building A Simple Cross-Browser Offline To-Do List With IndexedDB And WebSQL

Making an application work offline can be a daunting task. In this article, Matthew Andrews, a lead developer behind FT Labs, shares a few insights he had learned along the way while building the FT application. Matthew will also be running a “Making It Work Offline” workshop1 at our upcoming Smashing Conference in Freiburg in mid-September 2014. – Ed.

We’re going to make a simple offline-first to-do application2 with HTML5 technology. Here is what the app will do:

  • store data offline and load without an Internet connection;
  • allow the user to add and delete items in the to-do list;
  • store all data locally, with no back end;
  • run on the first- and second-most recent versions of all major desktop and mobile browsers.

The complete project is ready for forking on GitHub3.

Which Technologies To Use

In an ideal world, we’d use just one client database technology. Unfortunately, we’ll have to use two:

Veterans of the offline-first world might now be thinking, “But we could just use localStorage6, which has the benefits of a much simpler API, and we wouldn’t need to worry about the complexity of using both IndexedDB and WebSQL.” While that is technically true, localStorage has number of problems7, the most important of which is that the amount of storage space available with it is significantly less than IndexedDB and WebSQL.

Luckily, while we’ll need to use both, we’ll only need to think about IndexedDB. To support WebSQL, we’ll use an IndexedDB polyfill8. This will keep our code clean and easy to maintain, and once all browsers that we care about support IndexedDB natively, we can simply delete the polyfill.

Note: If you’re starting a new project and are deciding whether to use IndexedDB or WebSQL, I strongly advocate using IndexedDB and the polyfill. In my opinion, there is no reason to write any new code that integrates with WebSQL directly.

I’ll go through all of the steps using Google Chrome (and its developer tools), but there’s no reason why you couldn’t develop this application using any other modern browser.

1. Scaffolding The Application And Opening A Database

We will create the following files in a single directory:

  • /index.html
  • /application.js
  • /indexeddb.shim.min.js
  • /styles.css
  • /offline.appcache

/index.html

<!DOCTYPE html>
<html>
  <head>
    <link rel='stylesheet' href='./styles.css' type='text/css' media='all' />
  </head>
  <body>
    <h1>Example: Todo</h1>
    <form>
      <input placeholder="Type something" />
    </form>
    <ul>
    </ul>
    <script src="./indexeddb.shim.min.js"></script>
    <script src="./application.js"></script>
  </body>
</html>

Nothing surprising here: just a standard HTML web page, with an input field to add to-do items, and an empty unordered list that will be filled with those items.

/indexeddb.shim.min.js

Download the contents of the minified IndexedDB polyfill9, and put it in this file.

/styles.css

body 
  margin: 0;
  padding: 0;
  font-family: helvetica, sans-serif;


* 
  box-sizing: border-box;


h1 
  padding: 18px 20px;
  margin: 0;
  font-size: 44px;
  border-bottom: solid 1px #DDD;
  line-height: 1em;


form 
  padding: 20px;
  border-bottom: solid 1px #DDD;


input 
  width: 100%;
  padding: 6px;
  font-size: 1.4em;


ul 
  margin: 0;
  padding: 0;
  list-style: none;


li 
  padding: 20px;
  border-bottom: solid 1px #DDD;
  cursor: pointer;

Again, this should be quite familiar: just some simple styles to make the to-do list look tidy. You may choose not to have any styles at all or create your own.

/application.js

(function() 

  // 'global' variable to store reference to the database
  var db;

  databaseOpen(function() 
    alert("The database has been opened");
  );

  function databaseOpen(callback) 
    // Open a database, specify the name and version
    var version = 1;
    var request = indexedDB.open('todos', version);

    request.onsuccess = function(e) 
      db = e.target.result;
      callback();
    ;
    request.onerror = databaseError;
  }

  function databaseError(e) 
    console.error('An IndexedDB error has occurred', e);
  

}());

All this code does is create a database with indexedDB.open and then show the user an old-fashioned alert if it is successful. Every IndexedDB database needs a name (in this case, todos) and a version number (which I’ve set to 1).

To check that it’s working, open the application in the browser, open up “Developer Tools” and click on the “Resources” tab.

In the Resources panel, you can check whether it's working.
In the “Resources” panel, you can check whether it’s working.

By clicking on the triangle next to “IndexedDB,” you should see that a database named todos has been created.

2. Creating The Object Store

Like many database formats that you might be familiar with, you can create many tables in a single IndexedDB database. These tables are called “objectStores.” In this step, we’ll create an object store named todo. To do this, we simply add an event listener on the database’s upgradeneeded event.

The data format that we will store to-do items in will be JavaScript objects, with two properties:

  • timeStamp
    This timestamp will also act as our key.
  • text
    This is the text that the user has entered.

For example:

 timeStamp: 1407594483201, text: 'Wash the dishes' 

Now, /application.js looks like this (the new code starts at request.onupgradeneeded):

(function() 

  // 'global' variable to store reference to the database
  var db;

  databaseOpen(function() 
    alert("The database has been opened");
  );

  function databaseOpen(callback) 
    // Open a database, specify the name and version
    var version = 1;
    var request = indexedDB.open('todos', version);

    // Run migrations if necessary
    request.onupgradeneeded = function(e) 
      db = e.target.result;
      e.target.transaction.onerror = databaseError;
      db.createObjectStore('todo',  keyPath: 'timeStamp' );
    };

    request.onsuccess = function(e) 
      db = e.target.result;
      callback();
    ;
    request.onerror = databaseError;
  }

  function databaseError(e) 
    console.error('An IndexedDB error has occurred', e);
  

}());

This will create an object store keyed by timeStamp and named todo.

Or will it?

Having updated application.js, if you open the web app again, not a lot happens. The code in onupgradeneeded never runs; try adding a console.log in the onupgradeneeded callback to be sure. The problem is that we haven’t incremented the version number, so the browser doesn’t know that it needs to run the upgrade callback.

How to Solve This?

Whenever you add or remove object stores, you will need to increment the version number. Otherwise, the structure of the data will be different from what your code expects, and you risk breaking the application.

Because this application doesn’t have any real users yet, we can fix this another way: by deleting the database. Copy this line of code into the “Console,” and then refresh the page:

indexedDB.deleteDatabase('todos');

After refreshing, the “Resources” pane of “Developer Tools” should have changed and should now show the object store that we added:

The Resources panel should now show the object store that was added.
The “Resources” panel should now show the object store that was added.

3. Adding Items

The next step is to enable the user to add items.

/application.js

Note that I’ve omitted the database’s opening code, indicated by ellipses (…) below:

(function() 

  // Some global variables (database, references to key UI elements)
  var db, input;

  databaseOpen(function() 
    input = document.querySelector('input');
    document.body.addEventListener('submit', onSubmit);
  );

  function onSubmit(e) 
    e.preventDefault();
    databaseTodosAdd(input.value, function() 
      input.value = '';
    );
  }

[…]

  function databaseTodosAdd(text, callback) 
    var transaction = db.transaction(['todo'], 'readwrite');
    var store = transaction.objectStore('todo');
    var request = store.put(
      text: text,
      timeStamp: Date.now()
    );

    transaction.oncomplete = function(e) 
      callback();
    ;
    request.onerror = databaseError;
  }

}());

We’ve added two bits of code here:

  • The event listener responds to every submit event, prevents that event’s default action (which would otherwise refresh the page), calls databaseTodosAdd with the value of the input element, and (if the item is successfully added) sets the value of the input element to be empty.
  • A function named databaseTodosAdd stores the to-do item in the local database, along with a timestamp, and then runs a callback.

To test that this works, open up the web app again. Type some words into the input element and press “Enter.” Repeat this a few times, and then open up “Developer Tools” to the “Resources” tab again. You should see the items that you typed now appear in the todo object store.

03-step3-dev-tools-opt-50010
After adding a few items, they should appear in the todo object store. (View large version11)

4. Retrieving Items

Now that we’ve stored some data, the next step is to work out how to retrieve it.

/application.js

Again, the ellipses indicate code that we have already implemented in steps 1, 2 and 3.

(function() 

  // Some global variables (database, references to key UI elements)
  var db, input;

  databaseOpen(function() 
    input = document.querySelector('input');
    document.body.addEventListener('submit', onSubmit);
    databaseTodosGet(function(todos) 
      console.log(todos);
    );
  });

[…]

  function databaseTodosGet(callback) 
    var transaction = db.transaction(['todo'], 'readonly');
    var store = transaction.objectStore('todo');

    // Get everything in the store
    var keyRange = IDBKeyRange.lowerBound(0);
    var cursorRequest = store.openCursor(keyRange);

    // This fires once per row in the store. So, for simplicity,
    // collect the data in an array (data), and pass it in the
    // callback in one go.
    var data = [];
    cursorRequest.onsuccess = function(e) 
      var result = e.target.result;

      // If there's data, add it to array
      if (result) 
        data.push(result.value);
        result.continue();

      // Reach the end of the data
       else 
        callback(data);
      
    };
  }

}());

After the database has been initialized, this will retrieve all of the to-do items and output them to the “Developer Tools” console.

Notice how the onsuccess callback is called after each item is retrieved from the object store. To keep things simple, we put each result into an array named data, and when we run out of results (which happens when we’ve retrieved all of the items), we call the callback with that array. This approach is simple, but other approaches might be more efficient.

If you reopen the application again, the “Developer Tools” console should look a bit like this:

The console after reopening the application
The console after reopening the application

5. Displaying Items

The next step after retrieving the items is to display them.

/application.js

(function() 

  // Some global variables (database, references to key UI elements)
  var db, input, ul;

  databaseOpen(function() 
    input = document.querySelector('input');
    ul = document.querySelector('ul');
    document.body.addEventListener('submit', onSubmit);
    databaseTodosGet(renderAllTodos);
  );

  function renderAllTodos(todos) 
    var html = '';
    todos.forEach(function(todo) 
      html += todoToHtml(todo);
    );
    ul.innerHTML = html;
  }

  function todoToHtml(todo) 
    return '<li>'+todo.text+'</li>';
  

[…]

All we’ve added are a couple of very simple functions that render the to-do items:

  • todoToHtml
    This takes a todos object (i.e. the simple JavaScript object that we defined earlier).
  • renderAllTodos
    This takes an array of todos objects, converts them to an HTML string and sets the unordered list’s innerHTML to it.

Finally, we’re at a point where we can actually see what our application is doing without having to look in “Developer Tools”! Open up the app again, and you should see something like this:

Your application in the front-end view12
Your application in the front-end view (View large version13)

But we’re not done yet. Because the application only displays items when it launches, if we add any new ones, they won’t appear unless we refresh the page.

6. Displaying New Items

We can fix this with a single line of code.

/application.js

The new code is just the line databaseTodosGet(renderAllTodos);.

[…]

function onSubmit(e) 
  e.preventDefault();
  databaseTodosAdd(input.value, function() 
    // After new items have been added, re-render all items
    databaseTodosGet(renderAllTodos);
    input.value = '';
  );
}

[…]

Although this is very simple, it’s not very efficient. Every time we add an item, the code will retrieve all items from the database again and render them on screen.

7. Deleting Items

To keep things as simple as possible, we will let users delete items by clicking on them. (For a real application, we would probably want a dedicated “Delete” button or show a dialog so that an item doesn’t get deleted accidentally, but this will be fine for our little prototype.)

To achieve this, we will be a little hacky and give each item an ID set to its timeStamp. This will enable the click event listener, which we will add to the document’s body, to detect when the user clicks on an item (as opposed to anywhere else on the page).

/application.js

(function() 

  // Some global variables (database, references to key UI elements)
  var db, input, ul;

  databaseOpen(function() 
    input = document.querySelector('input');
    ul = document.querySelector('ul');
    document.body.addEventListener('submit', onSubmit);
    document.body.addEventListener('click', onClick);
    databaseTodosGet(renderAllTodos);
  );

  function onClick(e) 

    // We'll assume that any element with an ID
    // attribute is a to-do item. Don't try this at home!
    if (e.target.hasAttribute('id')) 

      // Because the ID is stored in the DOM, it becomes
      // a string. So, we need to make it an integer again.
      databaseTodosDelete(parseInt(e.target.getAttribute('id'), 10), function() 

        // Refresh the to-do list
        databaseTodosGet(renderAllTodos);
      );
    }
  }

[…]

  function todoToHtml(todo) 
    return '<li id="'+todo.timeStamp+'">'+todo.text+'</li>';
  

[…]

  function databaseTodosDelete(id, callback) {
    var transaction = db.transaction(['todo'], 'readwrite');
    var store = transaction.objectStore('todo');
    var request = store.delete(id);
    transaction.oncomplete = function(e) 
      callback();
    ;
    request.onerror = databaseError;
  }

}());

We’ve made the following enhancements:

  • We’ve added a new event handler (onClick) that listens to click events and checks whether the target element has an ID attribute. If it has one, then it converts that back into an integer with parseInt, calls databaseTodosDelete with that value and, if the item is successfully deleted, re-renders the to-do list following the same approach that we took in step 6.
  • We’ve enhanced the todoToHtml function so that every to-do item is outputted with an ID attribute, set to its timeStamp.
  • We’ve added a new function, databaseTodosDelete, which takes that timeStamp and a callback, deletes the item and then runs the callback.

Our to-do app is basically feature-complete. We can add and delete items, and it works in any browser that supports WebSQL or IndexedDB (although it could be a lot more efficient).

Almost There

Have we actually built an offline-first to-do app? Almost, but not quite. While we can now store all data offline, if you switch off your device’s Internet connection and try loading the application, it won’t open. To fix this, we need to use the HTML5 Application Cache14.

Warning

  • While HTML5 Application Cache works reasonably well for a simple single-page application like this, it doesn’t always. Thoroughly research how it works15 before considering whether to apply it to your website.
  • Service Worker16 might soon replace HTML5 Application Cache, although it is not currently usable in any browser, and neither Apple nor Microsoft have publicly committed to supporting it.

8. Truly Offline

To enable the application cache, we’ll add a manifest attribute to the html element of the web page.

/index.html

<!DOCTYPE html>
<html manifest="./offline.appcache">
[…]

Then, we’ll create a manifest file, which is a simple text file in which we crudely specify the files to make available offline and how we want the cache to behave.

/offline.appcache

CACHE MANIFEST
./styles.css
./indexeddb.shim.min.js
./application.js

NETWORK:
*

The section that begins CACHE MANIFEST tells the browser the following:

  • When the application is first accessed, download each of those files and store them in the application cache.
  • Any time any of those files are needed from then on, load the cached versions of the files, rather than redownload them from the Internet.

The section that begins NETWORK tells the browser that all other files must be downloaded fresh from the Internet every time they are needed.

Success!

We’ve created a quick and simple to-do app17 that works offline and that runs in all major modern browsers, thanks to both IndexedDB and WebSQL (via a polyfill).

Resources

(al, ml, il)

Footnotes

  1. 1 http://smashingconf.com/workshops/matthew-andrews
  2. 2 https://matthew-andrews.github.io/offline-todo/
  3. 3 https://github.com/matthew-andrews/offline-todo
  4. 4 http://caniuse.com/indexeddb
  5. 5 http://caniuse.com/sql-storage
  6. 6 http://caniuse.com/namevalue-storage
  7. 7 https://hacks.mozilla.org/2012/03/there-is-no-simple-solution-for-local-storage/
  8. 8 https://github.com/axemclion/IndexedDBShim
  9. 9 https://raw.githubusercontent.com/matthew-andrews/offline-todo/gh-pages/indexeddb.shim.min.js
  10. 10 http://www.smashingmagazine.com/wp-content/uploads/2014/08/03-step3-dev-tools-opt.jpg
  11. 11 http://www.smashingmagazine.com/wp-content/uploads/2014/08/03-step3-dev-tools-opt.jpg
  12. 12 http://www.smashingmagazine.com/wp-content/uploads/2014/08/05-step5-app-opt.jpg
  13. 13 http://www.smashingmagazine.com/wp-content/uploads/2014/08/05-step5-app-opt.jpg
  14. 14 https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache
  15. 15 http://alistapart.com/article/application-cache-is-a-douchebag
  16. 16 http://www.serviceworker.org/
  17. 17 https://matthew-andrews.github.io/offline-todo/
  18. 18 http://www.html5rocks.com/en/tutorials/indexeddb/todo/
  19. 19 http://nparashuram.com/IndexedDBShim/
  20. 20 http://alistapart.com/article/application-cache-is-a-douchebag
  21. 21 https://jakearchibald.github.io/isserviceworkerready/

The post Building A Simple Cross-Browser Offline To-Do List With IndexedDB And WebSQL appeared first on Smashing Magazine.

See more here:  

Building A Simple Cross-Browser Offline To-Do List With IndexedDB And WebSQL

Customizing WordPress Archives For Categories, Tags And Other Taxonomies

Most WordPress users are familiar with tags and categories and with how to use them to organize their blog posts. If you use custom post types in WordPress, you might need to organize them like categories and tags. Categories and tags are examples of taxonomies, and WordPress allows you to create as many custom taxonomies as you want. These custom taxonomies operate like categories or tags, but are separate.

More here – 

Customizing WordPress Archives For Categories, Tags And Other Taxonomies