Wednesday, June 25, 2008

Setting an alternative home page of portal in place of the default.aspx portal home page

Over time I've heard this request coming in several times, so this is the time to share my idea on how to make it happen. so far I've found this the easiest and quickest way. I'll talk about trade offs at the end.

This technique involves a couple of steps:

1. Add Content Editor Web part anywhere on your Portal home page, this web part will not be visible to end users, this is why placement does not matter.

2. Edit content of this Web Part through the HTML editor option available in the WP.

3. Paste the following script in there

<script type="text/javascript">

var start = document.cookie.indexOf( "MyPortalHome=" );

if (start < 0) {
     document.cookie = "MyPortalHome=Something";
     document.location.href="[my desired url]";


4. Replace [my desired url] with the url of your alternative home page

5. Save you changes :-)

Lets see what the script does:

var start = document.cookie.indexOf( "MyPortalHome=" );


This way we are checking for existence of the "MyPortalHome" cookie by setting "start" variable to the index location of the "MyPortalHome" cookie.


if (start < 0) {

if the cookie exists "start" variable will be more than -1, it will represent the actual start position of the cookie, if it is -1 then the cookie does not exist, meaning this is the firsts time user clicked on the portal url within this browser session. if this is the case we will execute the code below.
     document.cookie = "MyPortalHome=Something";

We are setting the cookie

     document.location.href="[my desired url]";

And redirecting users to the alternative Home Page.

If the cookie exists we are doing nothing. It will indicate that user got to this page before. T

he cookie will expire as soon as the user closes the browser, next time the user goes to the portal url the cookie will be set again and they will get redirected to the alt. home page.


1. if the user opens a new tab in IE and goes to the portal home, the cookie will persist and they will not get redirected, only when the browser is closed the cookie will expire with the end of the session.

2. To set the cookie in the browser you will have to allow to execute the script, you can prevent this behavior by modifying your security settings for this zone, or add this site to a list of trusted sites.

Have fun


Anonymous said...


why not simply change it in the site settings?

Natalya Voskresenskaya said...

Because when people already in the portal and click home, it should take they to default.aspx (home page of the portal)

Bryce Digdug said...

This is off subject, but do you have any recommendations on principles of folder organization? How many levels, when do you create new levels, etc.?

Natalya Voskresenskaya said...

I prefer to use metadata for file organization this is much more flexible than folders. Out of the box you can create only 2 level grouping views, but you can circumvent it by using third party tools or getting your hands dirty and come up with your own views. Regarding folder structure, it is all based on the purpose of your content, end-user culture, and business purpose. I never get into content organization without conducting a full discovery of the business needs. I’m not against folder structure (I’ve seen some 15 levels folder structure that made a lot of sense) , but because organization of your content into folders is a rigid way of content storage and had proven it’s weak points during “file share” times, I prefer to use content types and metadata.

Henry Ong said...

Hey Natalya, why not use the Site Welcome Page setting?


Natalya Voskresenskaya said...

because, the portal home page shoul remain as it is, but when a user clicks on http://portal/
it should bring them to a subsite by default (let's say, search center) from there they can click on the portal home page and see ... let's say whatever they have there (news?).
makes sense?

Vlad said...

Welcome page is part of Publishing Feature in Sharepoint. Sometimes site admins don't even have this option because Publishing feature is not activated on Web Application and Site Collection Level. But even if you get the Welcome Page option it has its limitations. It can only take the page that is within the scope of the site (not even site collection).

Anonymous said...

病院に行きたい。 [url=]バイアグラ[/url] バイアグラ

Anonymous said...

miley cyrus nude [url=]miley cyrus nude[/url] miley cyrus nude [url=]miley cyrus nude[/url]

Anonymous said...

Sì, questo messaggio di intelligibilità [url= ]acquistare cialis generico [/url]Credo che si sbaglia. Sono sicuro. Cerchiamo di discutere di questo. generico Molto buona domanda