Jan 282012
 

Many JavaScript programmers treat eval & new Function construct as the same. But new Function & eval are NOT the same. the important difference is:-

  • eval() works within the current execution scope and can affect local variables.
  • new Function() cannot affect local variables because the code runs in a separate scope

So both are evil & should only be used when there is no other way but as you may notice new Function is slightly less evil

Dec 292011
 

My bank has a stupidly disabled right-click on its website which I don’t like.

No Right-Click Allowed

No Right-Click Allowed

So I created clever JavaScript bookmarket to disable this restriction

Remove disable right-click restriction

Drag the above link to bookmarks bar & click on this when you want to enable right-click on pages where its been disabled!

here is the code:

javascript:void(document.oncontextmenu=null)
Aug 182011
 

Google Analytics (GA) is a free service offered by Google that generates detailed statistics about the visitors to a website. Its hugely popular tool which is used  57% of the 10,000 most popular websites on the currently, the list includes Twitter,myspace etc. GA tracks visitors & provides you useful information such as

  • Traffic source: If it was direct traffic, Purchased traffic via Ads or some other source
  • Information about Visitor: Their IP Address, country, Browser,time spend on site & lots of other information that could help you understand your visitors
  • And lots of other such useful bits of information.
What GA could not track until recently was social engagement, if someone click Like button,tweets or shared your site on social network. How do you track it? by default that social media traffic would be shown as DIRECT traffic which is not what you want.  But good news is Google analytics now support this and they are calling this _trackSocial method

the syntax is as follows: Continue reading »

Apr 172011
 

I was reading a review on amazon and unfortunately the person has posted in all uppercase. I tried to read but all uppercase text is harder to read, not to mention it is considered shouting on the web.In other words, you are reading the text on random site and just want to change it to lowercase. here is how:-

I used clever JavaScript bookmarket to transform all text on the current page into lowercase.

Convert text into Lowercase.

Drag the above link to bookmarks bar & click on this whenever you want to convert text into lower caps. quite cool and handy!

the code:

document.body.style.textTransform = "lowercase"
Dec 292010
 

 

JavaScript: 10 things I love & Hate

5 things I love & Hate about JavaScript

Introduction

 

JavaScript was developed by Netscape for their Netscape browser way back in 1995(which is like century in web development ). As we all know Netscape browser is dead but language has managed to live and has propagated into all major browsers.  JavaScript which was a Toy Language until recently, but now it been getting its much deserved attention.  It would be save to say, that if there is anything exciting happening in web development  arena- its JavaScript. JavaScript is Hot! this is the reason, I am been reading on JavaScript a lot these days. this post will summarize – 10 things I love and hate about JavaScript.

This is what I HATE:-

  1. Missing Class Concept: About the language syntax, JavaScript is different than classical programming languages like C/C++,Java,Python that we have grown up with. It takes different design approach. coders coming from popular Object-Oriented background will find it odd that that there is no concept of Continue reading »