Archive for the ‘Code’ Category

Add a bookmark link to encourage repeat traffic.

Tuesday, December 16th, 2008

Creating a bookmark link on your page allows visitors to add you page to their list of favorites. Once you have them there, you might as well do some self promotion.

The bookmark link I prefer is JavaScript and looks like this:

Place this code in the Head section of your site:

<script language=”JAVASCRIPT” type=”TEXT/JAVASCRIPT”>
var url =”http://www.yoursite.com;
var title = “Name of your site”;
function makeLink(){
if(document.all)window.external.AddFavorite(url,title)
}
// –>
</script>

Place this code where you want your bookmark link to appear:

<a href=”javascript:makeLink()”>Bookmark Us!</a> 

View A Visitor’s IP Address

Tuesday, December 16th, 2008

A very useful tool for webmasters is visitors’ IP Addresses. Once you have that information you can use it to do everything from tracking their location…to blocking unwanted guests.

The C# code looks like this:

string ipadd = Request.ServerVariables["REMOTE_ADDR"];