Saturday, February 23, 2013

Set this url as default/Home page of your browser


In this post we are going to set any url as default/Home page of your browser.
Recently one of my friend asked me to do this. So thought of sharing with you guys as well.
Consider we are going to set the http://www.google.co.in as the Default/Home page of the browser.

Add a below anchor tag to your webpage
<A style="CURSOR: hand; font-decoration: underline" href="#" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.google.co.in');">set as your home page</A>

So when user clicks on this button, a popin will appear asking to set google as the home page.
Just click on Ok. That's it, your browser has been updated with the default/Home page as google.com


Hope this helps...


Wednesday, December 5, 2012

Javascript to get query string value by passing the parameters siteUrl and querystringkey



In this post we will be writing a function to retrieve the query string value by passing the parameters siteUrl and querystringkey using Javascript.

Below is the function:
function getQuerystringForUrl(key,siteUrl) {   
    key = decodeURIComponent(key).replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + key + "=([^&#]*)";
    var regex = new RegExp(regexS);           
    var results = regex.exec(siteUrl);
    if (results == null)
        return;
    else
        return decodeURIComponent(results[1]);
}


Hope this helps...

Tuesday, December 4, 2012

How to Add a Favicon to a SharePoint Site or any regular website

In this post we are going to Add a Favicon to a SharePoint Site or any regular website.



A favicon is an image(.ico extension) associated with a particular Web page or a complete Web site. Favicon (pronounced fav-eye-con) is short for 'Favorites Icon.'
In Internet Explorer the Favicon is displayed on the Address bar and in the Tab.

Below are the steps to achieve this.
Step1:
Create a .ico image file with the below link by uploading your Logo.
Once the .ico file is created save it as favicon.ico and make sure it is of 16*16 Pixels.

Step2:
Adding the favicon reference to our website.
Add the below reference in the <head> section of your master page so that favicon will be displayed across the website. Or if you want to show it on particular page only, then add it to respective page itself.
<link rel="shortcut icon" href="your_path_to_favicon/favicon.ico" type="image/vnd.microsoft.icon" />

In Sharepoint to achieve the same we can use either the above code snippet or we can make use of below Sharepoint control SPShortcutIcon.
<SharePoint:SPShortcutIcon ID="SPShortcutIcon1" runat="server" IconUrl="/_layouts/images/favicon.ico"/>

You can give the IconUrl reference by placing the image either in the 14 hive or in the Image Library of your site collection. Both will workout.


Hope this helps...

Popular Posts