insertAdjacentHTML

Interesting article from

http://hacks.mozilla.org/2011/11/insertadjacenthtml-enables-faster-html-snippet-injection/

“On the computer that I used for testing, the innerHTML way of appending managed to append only slightly over 200 tweets in five full seconds. In contrast, the insertAdjacentHTML("beforeend", ...) way of appending managed to append almost 30,000 tweets in 5 seconds. (Yes, that’s hundreds versus tens of thousands.) Obviously, real Web apps should never block the event loop for five seconds—this is just for benchmark purposes. However, this illustrates how the innerHTML way of appending becomes notably slower as more and more content accumulates to be serialized and reparsed each time.”

Usage:

document.getElementById(‘ID’).insertAdjacentHTML(position, markup)

where position can be "beforebegin", "afterbegin", "beforeend", or "afterend"

UPDATE:

FireFox was the last browser to implement this method, so older FF browser cannot use this.

Posted in Web Related | Tagged , , | Leave a comment

Lazy Loading Asynchronous JavaScript

Useful article for keepsake, with a good dose of requirements that I like:

  1. Small. I don’t want a big mess for them to include on their sites. 10-15 lines, tops.
  2. Stand-alone. The environment is unknown, so we can’t rely on any external dependencies, like javascript libraries.
  3. Cross-browser. I have no idea what browsers my customer’s customers have, so I can’t do anything modern or fancy that isn’t backwards compatible. I assume at least IE6 and up though.
  4. Asynchronous download. The download of my script should not block the download of any script on their sites.
  5. Lazy Loading. If my site is temporarily slow, I don’t want to block the onload event from triggering until after our site responds.
  6. Preserve events. Any events used should not override any events on the customer’s site. Minimal impact, like I said.
  7. Don’t pollute namespace. Global variables should be avoided, since they could conflict with existing javascript.

http://friendlybit.com/js/lazy-loading-asyncronous-javascript/

(function() {
function async_load(){
      var s = document.createElement('script');
      s.type = 'text/javascript';
      s.async = true;
      s.src = 'http://yourdomain.com/script.js';
      var x = document.getElementsByTagName('script')[0];
      x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
      window.attachEvent('onload', async_load);
else
      window.addEventListener('load', async_load, false);
})();
Posted in Web Related | Tagged , , | Leave a comment

Honoring Steve Jobs

“Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because almost everything — all external expectations, all pride, all fear of embarrassment or failure – these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.”

- Steve Jobs

http://www.huffingtonpost.com/2011/10/05/steve-jobs-stanford-commencement-address_n_997301.html?ir=Technology

Posted in Random | Tagged | Leave a comment

Fake PageRank

It is actually possible to fake PageRank by setting up redirection.
Just a quick search amongst the domain name sellers in Australia actually found people doing this.

To check whether a domain is truly reflecting it’s own PageRank, simply Google:

info:exampledomainname.com

If the result shows another domain not as per the one you typed in search, you know there is redirection set up and the searched domain’s PageRank is actually the one you see being ‘reflected’ by the redirect. You would be a fool to be buying a domain thinking it has a high page rank when it has zero

A quick search in Google:

link:exampledomainname.com

Will also reveal some back-links Google recognise to the searched domain name. The more authoritative the back links to the domain, the more valuable the domain.

Posted in Random | Tagged , , | Leave a comment

Live website tracking

It’s seldom that I get excited enough about a product to actually write about it.

Recently I signed up for http://chartbeat.com for about $10 bucks a month. It allows me to track up to 5 websites. What it does:

How many visitors on the website at any point of time,
which page they are at,
where they are from geographically,
source of referral,
downtime/recover time alerts,
any twitter conversation pointing to my website

Essentially a dashboard to track my whole website status live… For a website with hundreds of pages, this is very useful indeed. It helps to zero in on pages which may be getting substantial traffic but not converting (or those pages getting minimal traffic and converting better). It makes me think more about the copy of the page… or design…  whatever may not hitting the mark in converting traffic into leads.

The downtime alerts and twitter conversation tracking is like icing on the cake. This is definitely a useful tool which compliments Google Analytics and ClickTale.

 

 

Posted in Web Related | Leave a comment

Nice SEO tips from RSS Pieces

From RSS Pieces:

“You need to look for links from EDU pages that have some authority and some valuable content.  To find these pages you use common operators in Yahoo:”

  • linkdomain:example.com site:.edu sponsors
  • linkdomain:example.com site:.edu donors
  • linkdomain:example.com site:.org sponsors
  • linkdomain:example.com site:.org benefactors
  • inkdomain:example.com site:.edu hotlinks
  • linkdomain:example.com site:.edu bookmarks
  • linkdomain:example.com site:.org directory
  • linkdomain:example.com site:.org resources
Posted in Web Related | Tagged | Leave a comment

Digital Media for Brands

 

Posted in Web Related | Tagged , , | Leave a comment

Changing Default jQuery AJAX properties

$(document).ready(function() {
$.ajaxSetup({ cache: false });
});

http://api.jquery.com/jQuery.ajaxSetup/

Posted in Web Related | Tagged | Leave a comment

Great tool for interacting with Canvas or creating Canvas applications

http://kangax.github.com/fabric.js/test/demo/

Posted in Random | Tagged , , , | Leave a comment