You may aware there is a welcome sign displayed on the top of this paragraph. Depending on what is your current IP address and where are you coming from, the welcome sign will be displayed in different languages (Chinese, English, French, Japanese, and Spanish). How this can be done? Actually, it's quite easy to do it without any coding efforts. Here are the sample code fragment and a simple complete example (simple3.html).


<div class="glFilter" group="Sign" country="JP"><img src="welcomeJP.gif"></div>
<div class="glFilter" group="Sign" country="CN,HK,TW"><img src="welcomeCN.gif"></div>
<div class="glFilter" group="Sign" country="AD,AR,BO,BZ,CL,CO,CR,CU,DM,EC,ES,GT,HN,MX,NI,PA,PE,PR,PY,SV,UY,VE"><img src="welcomeES.gif"></div>
<div class="glFilter" group="Sign" country="BE,BF,BI,BJ,CD,CF,CM,DJ,FR,GA,HT,KM,MC,MG,ML,NE,RW,SC,SN,TD,TG,VU"><img src="welcomeFR.gif"></div>
<div class="glFilter" group="Sign"><img src="welcomeUS.gif"></div>

The logic of the above code fragment is following :

  1. Set the class of an HTML element (like <div>) to be "glFilter". The contents of this GeoLOcal HTML element won't be displayed until its specified GeoLocal criteria (country, region, and city) are matched.

  2. Optionally, we can group several GeoLocal HTML elements together with the same ID, and bind serveral GeoLocal HTML elements working together.

  3. In the above example, if the web site visitor is from Japan, then the Japanese welcome sign will be displayed. If the visitor is from Chinese speaking countries or areas, then the Chinese welcome sign will be displayed. The same logic applies to those from French or Spanish speaking visitors. However, if the visitor is not coming from all above countries or areas, the default English welcome sign will be displayed.

  4. Here is the complete country code list.

Please continue to GeoLocal :: Filter - Part II.



© 2010 ToGo Software. All rights reserved.