Darrell Norton's Blog [MVP]

Sponsors

The Lounge

News

  • Darrell Norton pic

    MVP logo

    View Darrell Norton's profile on LinkedIn

    Currently Reading:

    weewar.com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Cross-browser DHTML behaviors (.htc files)

Grant points us to a cross-browser drag-and-drop example. Good stuff, and Grant was the king of Javascript at a previous employer, so I’ll listen to his recommendation. etLux’s implementation, though, seems to rely on pasting code into too many different places.

I like the simplicity of Dean Edward’s moz-behaviors (bold emphasis mine).

  • moz-behaviors.xml is an XBL binding that allows Mozilla browsers (Netscape, Mozilla, Firefox etc) to use Microsoft DHTML Behaviors with little or no conversion. Mozilla and Explorer may then reference the same DHTML Behaviors (.htc files).
  • moz-behaviors.xml is the only file you need to enable DHTML Behaviors for Mozilla browsers.
  • the XBL binding includes code that implements the addBehavior method for Mozilla’s HTML Elements. The code has been compressed using the javascript packer available from this site.
  • you do not need to write any additional code to implement DHTML Behaviors for Mozilla.
  • further, when writing behaviors, you do not need to do any browser sniffing. Mozilla’s object interfaces have been extended to enable browser compatibility.
  • you can view a working example here: /my/examples/moz-behaviors/
  • you can download the wrapper and the example here: /download/

Posted 12-10-2004 12:52 PM by Darrell Norton

[Advertisement]

Comments

Dax wrote re: Cross-browser DHTML behaviors (.htc files)
on 02-03-2005 7:33 AM
Hi

Could you please tell me how exactly HTC files work? Like, what is the sequence of events? When a webrequest is made, then how htc is applied....and is it cached at client side or not?

Any help is appreciated.

thnx
JCooney.NET wrote re: Async Callbacks in ASP.NET 2.0 PDC Release - What's wrong with this picture?
on 01-03-2006 2:29 PM