1 out of 3 rated this helpful - Rate this topic

isHomePage Method

Determines whether the specified URL refers to the client's home page.

Syntax

bQueryHome = homePage.isHomePage(sPageURL)

Parameters

sPageURL Required. A String that specifies the path or file name to compare against a client's specified home page.

Return Value

A Boolean. Returns one of the following values:

true
The client's home page is the same as the provided argument.
false
The client's home page is different than the provided argument.

Remarks

The isHomePage method returns false if the argument and a user's home page are the same, but the document calling the method is on a different domain from the user's home page.

Example

This example uses the isHomePage method to determine whether a user's home page is the same as the specified URL.


<HTML XMLNS:IE>
<HEAD>
<STYLE>
@media all {
   IE\:HOMEPAGE {behavior:url(#default#homepage)}
}
</STYLE>

<SCRIPT>
function fnVerify(){
   sQueryHome = oHomePage.isHomePage(oHomeHref.value);
   alert(sQueryHome);
   event.returnValue = false;
}
</SCRIPT>
</HEAD>
<BODY>
<IE:HOMEPAGE ID="oHomePage" />
<INPUT TYPE=text ID=oHomeHref VALUE="http://www.microsoft.com">
<INPUT TYPE=button VALUE="Verify" onclick="fnVerify()">
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/isHomePage1.htm

Applies To

homePage

See Also

Introduction to DHTML Behaviors
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
isHomepage always return false IE8 Script Console
After some testing, I've also found it to be true that this method returns false any time it's called from the script console in IE8. I'm not sure why, but attempting to do something like this in the script console while visiting Google's homepage will get you nothing but false:

>>document.body.style.behavior = 'url(#default#homepage)'
"url(#default#homepage)"
----------------------------------------------------------------------
>>document.body.isHomepage('http://www.google.com')
false

If you run that bit of code on window load either in-line in the page or via an included JS file from a domain you control (and obviously changing google.com to that domain), the method returns true as expect.
isHomepage where firefox doesnt supported

the function which firefox doesnt support,any idea of the substitute

[Noelle Mallory - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content.