Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Www automaticaly in url if not exists

Posted by Viral Sarvaiya on July 1, 2009

<script language=”javascript”>
var sLink = window.location.href.toLowerCase(); ;
if (sLink.indexOf(“http://&#8221;) > -1) {
if (sLink.indexOf(“www.”) == -1) {
sLink = sLink.replace(“http://&#8221;, “http://www.&#8221;);
window.location.href = sLink;
}
}
</script>

Put this script in head tag of your page

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: