HTMLGoodies
The ultimate html resource
Earthweb.com


About the Double-Underlined Links



Search Clipart.com:



internet.commerce
GPS
Online Education
Domain registration
Find Software
Car Donations
Cell Phones
Memory Upgrades
Online Shopping
Corporate Awards
Corporate Gifts
Holiday Gift Ideas
Computer Hardware
GPS Devices
Logo Design Custom

HTML Goodies : Beyond HTML : DHTML/Layers: So You Want to Add Your Page to Favorites, Huh?

 Silverlight 2 SDK for Visual Studio 2008
This package is an add-on to the RTM release of Visual Studio 2008 to provide tooling for Microsoft Silverlight 2 Beta 1. It provides a Silverlight project system for developing Silverlight applications using C# or Visual Basic. »
 
 Article: What Does it Take to Build the Best RIA?
With the proliferation of Rich Interactive Application (RIA) platform choices out there, you no longer have to take a one-size-fits-all approach to developing your next RIA application. Knowing the strengths (and weaknesses) of each platform can help you to decide the best RIA for your next application. »
 
 Expression Blend 2.5 Preview
Use Expression Blend 2.5 to create and modify managed Silverlight 2-based applications. Expression Blend for Silverlight 2 includes all of the features in Expression Blend 2 but has not reached the quality level of Expression Blend 2 for WPF or Silverlight 1 development. »
 
 The Hottest Mobile Platform Meets the Hottest RIA Platform
With the Symbian OS now supporting Microsoft Silverlight, mobile developers can bring new and exciting capabilities to handsets all over the globe. Find out why developers now need to make mobile devices a core part of their RIA development strategy. »
 
 Article: Leveraging Your Flash Development with Silverlight
You're not giving up Flash any time soon (and we don't blame you.) But if you could get your Flash application working in Silverlight, why wouldn't you? We show you the tools and techniques required to have your rockin' Flash application rolled for Silverlight. »
 

HTML GOODIES TO GO NEWSLETTER


Other Related Newsletters

eKit: Rational Build Forge Express. Access valuable resources to help you increase staff productivity, compress development cycles and deliver better software, fast.

So You Want to Add Your Page to Favorites, Huh?


By Joe Burns

...use these to jump around or read it all
[Add This Page to Your Favorites] [The Coding]
[Only in IE4 or Better]

     First Things First: What you're reading is a tutorial that will work with Internet Explorer browsers version 4.0 or better only. At the moment (5/15/99) there isn't a method equal to this one in Netscape. But as soon as I know of one, I'll add it here.


Add This Page to Your Favorites

     I'll give you a couple of methods first and then show you the code for each.

 

Add this page to your favorites

     If you got an error, then you're not using the correct browser. Later in the tutorial I'll show you how to make sure that this code only shows up on browsers that understand it.


The Coding

     We'll do the button code first. It's the easier of the two.

<FORM>
<INPUT TYPE="button" VALUE="Add To Favorites"
onClick='window.external.AddFavorite(location.href, document.title);'>
</FORM>

     It's a basic HTML form button. The onClick Event Handler is what does the trick. The code is DHTML and is proprietary to Internet Explorer. That's a fancy way of saying only MSIE4.0 or better understands what the heck you're talking about. You know - like that smart kid in Spanish class.

  • window.external states that an external window will be called upon.
  • AddFavorite does just what it says. It adds something to your favorites menu.
  • location.href, document.title is what it adds, the page's URL and the document.title.

     Once the command spawns the external Favorites window, you take it from there.

     Now here's the basic link code. It's done with the SPAN tag and some Cascading Style Sheet commands:

<U>
<SPAN STYLE='color:blue;cursor:hand;'
onClick='window.external.AddFavorite(location.href, document.title);'>
Add this page to your favorites
</U>

     As you can see, the link is a bit of a trick. It isn't a hypertext link at all. The blue coloring and the hand icon come from a style sheet commands. The underline comes from <U> and </U>.

     The onClick Event Handler is exactly the same as it was in the button. Same effect. Different code.


Only in IE4.0 or Better

     I have an entire tutorial on doing this here, but I'll quickly give you the code. You can go and read more on what's happening at your leisure.

     You really only want this "add to Favorites" code to be available to those using IE 4.0 or above. There's no use of having the code pop up on Netscape 3.0 as it will only throw errors. But you still want people to bookmark or add your page to favorites. That's done on all other browser by hitting Ctrl-D. So let's make it so that if the browser is IE4.0 or better, the code for one of these buttons pops up and if the browser is anything other than IE4.0 or better, text pops up asking the user to hit Ctrl-D. OK?

Here's the Code

     It's a quick test of the browser. If the browser meets the criteria, the code, or the text is written to the page. Nothing to it.


That's That

     Use it in good health. I know I'll start to see this all over the place pretty soon.

 

Enjoy!

[Add This Page to Your Favorites] [The Coding]
[Only in IE4 or Better]

Tools:
Add htmlgoodies.com to your favorites
Add htmlgoodies.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

IT Management Networking & Communications Web Development Hardware & Systems Software Development Earthwebnews.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES