Baumeister Mediasoft Engineering BME - Baumeister Mediasoft Engineering  JavaScript Method AddFavorite (IE4) - English Version JavaScript-Methode AddFavorite (IE4) - Deutsche Version
Baumeister Mediasoft Engineering
Bartels AutoEngineerCarLogServicesResourcesCompany ProfileContact Us
Baumeister Mediasoft Engineering » Resources » Web Development » JavaScript » Methods » AddFavorite
JavaScript Methods

JavaScript Method AddFavorite (IE4)

Baumeister Mediasoft Engineering

The AddFavorite() JavaScript function can be used in Internet Explorer (version 4 or higher) to add a web address (with a title) to the Internet Explorer favorites. AddFavorite() activates the Add to Favorites... function from the Internet Explorer Favorites menu with the given parameters.

The following AddFavorite() call can be used to add the BME website address with its title to the Internet Explorer favorites:

window.external.AddFavorite(
    
'http://www.bme.ie',
    
'BME - Baumeister Mediasoft Engineering'
    
);

The following AddFavorite() call can be used to add the currently loaded page to the Internet Explorer favorites:

window.external.AddFavorite(location.hrefdocument.title);

A web browser compatibility check such as

if (window.external)
{
   
window.external.AddFavorite(location.hrefdocument.title);
}

is recommended since AddFavorite() is only available in Internet Explorer (version 4 or higher).

onclick() can be used to provide a clickable link to the AddFavorite() function call. The following JavaScript code displays a link for adding the currently loaded page to the Internet Explorer favorites:

<script type="text/javascript">
<!--
//--><![CDATA[//><!--
if (window.external)
{
    
document.write(
        
'<a href="#"'
        
' onclick="window.external.AddFavorite(location.href,document.title);">'
        
'Add this Page to your Favorites...</a>'
        
);
}
//--><!]]>
</script>

Related Links

Related Topics

Baumeister Mediasoft Engineering » Resources » Web Development » JavaScript » Methods » AddFavorite

JavaScript Method AddFavorite (IE4) • © 2025 Manfred Baumeister • Updated: 29 October 2008, 14:15:03 GMT

Baumeister Mediasoft Engineering, Clontarf, Dublin 3, D03 HA22, Ireland
© 2025 Manfred Baumeister

JavaScript Method AddFavorite (IE4) - English Version JavaScript-Methode AddFavorite (IE4) - Deutsche Version