The page getting by far the most hits on the Hoeben.net site is my entry about HTC components in Windows XP SP2, due mostly thanks to a mention on Peter Nederlof's page about the csshover component (which I am currently using in the Hoeben.net site, thanks!).
I got a couple of questions on how to change the mime type of HTC files, especially if you don't have access to some server settings, and/or you are not that .htaccess saffy. On Hoeben.net I'm missing some override permissions, so I needed a workaround myself. Here's what I did...
I am using a PHP wrapper that sets the correct mime-type. Instead of referencing a HTC file directly, I am wrapping it through the PHP script.
Instead of:
body { behavior: url(csshover.htc) }
I am using
body { behavior: url(htcmime.php?file=csshover.htc
The htcmime.php file looks as follows:
<?php
// Get component file name
$fname = (array_key_exists("file", $_GET)) ? $_GET["file"] : "";
// basename() also strips \x00, we don't need to worry about ? and # in path:
// Must be real files anyway, fopen() does not support wildcards
$ext = array_pop(explode('.', basename($fname)));
if (strcasecmp($ext, "htc") != 0 || !file_exists($fname))
exit ("No file specified, file not found or illegal file.");
$flen = filesize($fname);
header("Content-type: text/x-component");
header("Content-Length: ".$flen);
header("Content-Disposition: inline; filename=$fname");
$fp = fopen($fname, "r");
echo fread($fp, $flen);
fclose($fp)
?>
Update: If you're more of an ASP person, check out SpiritOfGrandeur's comment below. Thanks!
Comments
not working in IE on MAC OS X
Is there any idea for HTC working on MAC OS X? I am using IE 5.2.3
thanks
PHP Converted to ASP
Here is the code for ASP. Thanks for the writeup on all this HTC stuff :)
This code doesn't work for
This code doesn't work for me. It appears that the first IF statement has a syntax error.
Also, there's no real mention about what to do in the stylesheet when using this code. Is the following still accurate?
I'd appreciate any advice on how to proceed
Ok you guys, I've tried my best to figure all this out for myself. I've already visited http://www.xs4all.nl/~peterned/csshover.html but I still can't seem to make the dropdown menu work for IE. My site is http://bltmarketing.ca/wgn-test/about.html
I've even put an .htaccess in the wgn-test folder, I've even tried calling the host server and they said that they can see the drop down just fine in IE. I don't know why it won't work for me, and I'm pretty sure that the majority of my client's audience won't be able to see it in IE either.
I would really appreciate any advice you can give to get this to work. Thank you kindkly, Donna.
My spoon is too big.
Donna,
Donna,
Did you ever figure out the problem? If so, I'd be curious what you did.
It seems to work, so I guess
It seems to work, so I guess she figured it out (and likely won't be visiting this post again...)
hoeben...
your navigation doesn't even show up in Mac/IE. I don't mean the drop-down, the whole black bar is gone.
I'm trying to solve this htc hover issue myself and none of the examples work so far on Mac/IE. 5.17-5.23. just fyi.
.mike
I am considering IE for Mac
I am considering IE for Mac a dead browser (as does Microsoft). I am sure it won't work with Netscape 4 either...
Note that IE for Mac is a totally different product than IE for Windows, and it doesn't support HTC or the stylesheet behaviors.
Mime type htc files
Im soooooo confused about mime type
isnt theri something I can just add to the htc itself?
-Thanks for all the great work!
Thankyou so much for this
Thankyou so much for this script. I had been trying to find some workaround for this problem for several hours now. Your php solution worked perfectly for me.
Re: I've wrapped the csshover in the PHP script
I can't seem to get this to work. I have wrapped the htc file in a php file. However, I still doesn't work in IE 6.0.29 on XP.
Do you have a copy of the HTC file you used? What the HTC file specific to this use of wrapping it in a PHP file or is it the same file that Peter came up with?
Thanks for this
Thanks for this solution!
Have been looking for something like this for a white and it worked like a charm!
ColdFusion cfheader/cfcontent wrap for .htc
The HTC components/XP SP2 junk drove me nuts. Finally, though, I also used a wrapper for ColdFusion, very similar to the PHP and ASP examples with one minor difference: the "inline" value in the header needed to be dropped. Why? Good question but I don't have an answer and I couldn't find one on LiveDocs.
Here's the code for the wrapper:
I saved the wrapper as csshover_wrap.cfm and...
became...
Re: ColdFusion cfheader/cfcontent wrap for .htc
Great stuff!
Re: ColdFusion cfheader/cfcontent wrap for .htc
If someone could point me to the right direction, I would be very thankful!
Re: ColdFusion cfheader/cfcontent wrap for .htc
I tried this solution and the php solution, none of them solved the problem on IE 6.29 on SP2;
The CF solution also collapsed the lines of the menu on firefox 2.0.0.16.
I would like to know how do I implement the ASP solution from above, since I'm a real newbie and don't know how to make the CSS call the htc through the ASP.
Anyway, thanks for these awesome tips... I hope the ASP will work, once I learn how to use it :D
IE shows the drop down menu locally but fails remotely. WHY?!
I have followed instructions on this and Peter Nederlof's pages for creating css drop down menu, and everything works fine on my local server, but when I upload the site to the remote server, IE refuses to show the menu, even though it did show it (the same version, the same code) properly locally.
IE does not report any error, so I just can not locate the problem. I guess that if 'csshover.htc' helps IE override its css bugs, then if it is unable to find/read/understand it, it won't be able to use it. So, I checked the path referring to the 'csshover.htc', tried with proposed workaround for adjusting the mimetype, tried with adding the mimetype text/x-component for htc in my site's cPanel, and nothing worked.
Obviously, I am missing something, but I can not see what. If someone could point me to the right direction, I would be very thankful!
Link?
It sounds exactly like what you would see without the proper mimetype set. Do you have a link so one of us can check whether the mimetype is set correctly on your server?
Sure, here is the link:
http://ekopanonija.bosskovic.com/
Thanks for help!
Works for me...
The link you provided has CSS menus that work fine for me in IE6 on WinXP. Did you fix it? Are you sure they are not working for you?
Make sure you don't have scripting disabled on your Internet Explorer
Works for me too
I'm so stupid; the security level in my IE was set to "high".
I don't use IE for browsing, so this was probably set by SP. I guess that this might be the situation with other surfers too. If its not to much out of the scope of this page, is there any way to check the level of security in the visitor's IE using PHP, and to warn him to change it?
Thanks again for your help!
more easily way to make it in PHP ;-)
Hi!
Instead of having a PHP and a HTC file AND loosing (minimal) resources by the server I suggest to make it this way:
(usually I only need 1 HTC file to solve my problem, and this use less resource and this cause less security holes because of this is standalone, no need to pass any parameters and/or files)
csshover.htc.php:
========================
<?php
ob_start();
?>
[Copy here the orginal HTC file content]
<?php
header("Content-type: text/x-component");
header("Content-Length: ".ob_get_length());
header("Content-Disposition: inline; filename=csshover.htc");
ob_end_flush();
?>
========================
Re: more easily way to make it in PHP ;-)
I was able to get your drop-down menu working. However, I cant seem to get the drop-down to work on IE 6.0.29.00 XP.
Re: HTC components in XP Service Pack 2 (2)
Hi,
I'm still experiencing problems with the csshover. I have wrapped the file in a php file like you said. I have lowered my security settings so that I was able to get your drop-down menu working. However, I cant seem to get the drop-down to work on IE 6.0.29.00 XP.
any suggestions would be greatlt appreciated.
Thank you, Trev
Re: HTC components in XP Service Pack 2 (2)
I’m as big a pusher of standards (and firefox ;-) as they come, but in a commercial situation where you’ve got a CMS built for IE6 only, written mostly with .HTC files, this WAS really important. For some of us it’s got to do with money and functionality, not design. In my opinion Microsoft stuffed up by burning the very people they enticed into their new technology years ago.
So thanks a lot for the info - much appreciated.
Re: HTC components in XP Service Pack 2 (2)
IE7 no longer uses HTCs. It is now a pure JavaScript solution. Some developers did not have access to their servers and could not make the necessary configurations there.
Re: HTC components in XP Service Pack 2 (2)
Both 'sensible' applications of using HTC were made redundant by IE7 anyway; IE7 displays PNG transparencies just fine, and has decent support for css :hover.
Re: HTC components in XP Service Pack 2 (2)
This just saved my ass, thanks!
Re: Previous Thread
Aldo,
Thank you for this life saving script!
And by the way, do you have a copy of the HTC file you used? What the HTC file specific to this use of wrapping it in a PHP file or is it the same file that Peter came up with?
Thanks!
Sincerely,
John Maven
Re: HTC components in XP Service Pack 2 (2)
I am still not able to get my navigation to work in IE 6 on Windows XP using this solution.
Could someone take a look at this page and let me know if you can see the problem?
My page
Re: HTC components in XP Service Pack 2 (2)
Nevermind. It was just a php issue. Works great. Thanks!