How to Find and Display visitor's location with Javascript and Google API in Easy Steps

This script will find out visitor's exact city (in most cases). You also get the visitor's latitude and longitude, as well as state, country, and country code.

Google provides IP address to location translation for free. Whenever you use Google's jsapi script to dynamically load a Google AJAX API, Google automatically populates google.loader.ClientLocation, which contains the web visitor's location.

Google provides IP address to location translation for free. Whenever you use Google's jsapi script to dynamically load a Google AJAX API, Google automatically populates google.loader.ClientLocation, which contains the web visitor's .

Fire Event Programmatically in Javascript and bind with Shortcut key

to register shortcut key. function triggerEvent(el, eventName, options) { var event ... , some web based editors use iFrame as edit area, you want to bind some editing actions to a shortcut key ... over the button , click an then switch back to keyboard, using a shortcut key can significantly ... save your time. You can even package a series of actions into one shortcut key, for example, create

How to zoom image to make it fit to width of div

There is common problem when display image in web page, the width of the image size may too big to fit into the page. Suppose there are two columns float in a div, the left float will display an image, the right float will show text.

How to copy text from Chrome Console to file using javascript

Consider this problem, you find a list of links on a web page, and you want get its URL and link address and save them to a file. If there are only several links, you can get them by right clicking the mouse on the link and copy link address or select the link text to copy the link .

How to toggle partially show and hide of DOM element without jQuery

Some DOM elements are visually annoying, for example a long list, we may want to only show a small part of the element, and expand to full length when the mouse is hovering on it. Its a simple script, we want the smallest javascript footprint, we don't use jQuery. With some decent micro pieces of javascript snippet, wen can .

How to set breakpoint for JQuery event handler in Chrome DevTool Event Listeners

Find out which and where an event is register by jQuery can be tricky. Select the element in Elements panel in DevTool in Chrome and select Event Listeners tab in the right side the the panel. You can only locate the javascript code inside jQuery. And all event point to the same location in jQuery. What you actually see .

What is closure in Javascript and how to use it

Closure is widely used in Javascript, I should say closure is used almost everywhere in Javascript. The closure is the corner stone of several widely used design pattern in Javascript. For a Javascript developer you will use closure in you day to day programming job.

Javascript function hoisting confusion

I was looking at code like this

And suddenly I feel confusing about the function defined in obj var literal definition. Its accessing the obj var's properties inside the function which is also a part of the objection definition(at least it looks like so).

An example of using Hogan.js template engine

point. So what is the fastest way to get a template engine work. I will suggest Hogan.js works ... Need a template engine? You will need it at some ... and npm , type this command to get Hogan.js npm install hogan.js [A simple template] Hogan.js ... with nodejs. Let's have a quick tour about Hogan.js. [Get Hogan.js] If you have installed nodejs

How to list properties of object in Javascript

This is a task that looks easy at first sight, but when you start to actually do it, things becomes a little bit complex.

The naive way is a simple for in loop.

1 2 3 Next Page