Forcing IE to download NOT open files - .htaccess

We have a simple html page with a list of links on a Tomcat server. Many of the links are just a simple .msg file for users to download, fill-in and send. Works great in Chrome but not in IE. IE tries to load the .msg file and all you see is 'garbally gook'.
I've tried searching for answers but none have worked so far.
Tried:
- Adding 'download' to the tag but of course this isn't supported in IE.
- Tried adding a .htaccess file with: AddType application/octet-stream .msg, but this didn't work either.
Tomcat is by Apache so I'm really surprised the .htaccess file answer didn't work. Some answers suggested using PHP or adjusting config files, but this is a little over my head. Who would have thought such a seemingly simple question would be so technical to fix!
Many thanks for any direction you are able to suggest!

I finally found my answer so for the next none techy, hopefully this will help you too!
For Apache Tomcat, find your web.xml and open in Note Pad. Search for MIME, you want to keep going until you find your MIME types, they will look like the below code. They are sorted alphabetically so place your new MIME type accordingly. For me it was a .msg file that I wanted IE to prompt an open/save as, rather than just trying to opening it.
<mime-mapping>
<extension>msg</extension>
<mime-type>application/vnd.ms-outlook</mime-type>
</mime-mapping>
To find the appropriate MIME type, I just did a Google search for 'Outlook .msg MIME Type' and found it pretty quickly. After you have added your new MIME Type save and restart your server.
Issue: web.xml wouldn't let us save over it. We got around this by saving our new file with a different name, rename/delete the existing web.xml file and then renaming the updated file back to web.xml.
Issue: After restarting the server, IE STILL tried to read the .msg file rather than opening it, even after refreshing cache, grrrr! Trying another link we hadn't tried before, revealed the new MIME Type to be working and testing on another computer confirmed it.
Good luck!

Related

.htacces folder name with same file name?

I have a file in my webpage called news.
I did not write .html the end of the file, is this still correct? (the browser shows like html)
I want to make a folder in my server with the same name and put the articles there.
For example:
www.example.com/news ->>> this shows the main news page
www.example.com/news/article0101 --> this shows the article
If a user type www.example.com/news or www.example.com/news/ both must show the main news page.
In my webserver, I made all files without any extension.
I have read previous Q/A -s from this page and other pages and I have did not found a valid soulution to my problem?
Can I even modify the .htacces file in this way? Or I approach the problem in the wrong way?
Do I require a database or I just need files if I want to write articles?
Where can I find standard documentation for a webpage with articles and news?
Thanks very much your help

KML relative URL warning

I have this little piece of KML code which shows an image when clicked on the placemark, all images i have are store locally, and it works fine when using the .kml file it self.
Once the file is compressed into .kmz i'll get a warning (yellow marked) on the first line of the CDATA, covering some of my text.
It says: "This balloon may be using incorrectly formatted image URL"
All of my images works fine, they are not missing, and the relative URL is correct, but the syntax is not.
Anyone out there know of a solution to get rid of that hardcoded message ? or even better how to "tune" the code, so this warnings don't show :)
I've seen a couple of examples, stating it should help, but none suits my need, unfortunally.
This was some of the solutions i've looked at, but still not got it working.
Option 1: Fix the URLs
Your base URL is one directory down from where you thought it was, so you can simply add “../” to the beginning of each offending relative URL. This works fine in earlier versions of Google Earth as well, because older versions will look in both directories (and as a bonus, your content will render faster in older versions).
To fix the above example, we’d change:
<img src="images/image.png”>
to
<img src="../images/image.png">
Option 2: Add a <base> tag
As with any other browser, you can add a <base> tag to your HTML to set the base URL of that content. The href parameter of the <base> tag must be an absolute URL, so you’ll have to hard-code your server name and path. Adding the <base> tag to your BalloonStyle can fix all of your URLs in one go.
To fix the above example, we’d add: <base href="http://host.example.com/kmz/somelayer/"> to the BalloonStyle (or description, if we only have a few affected placemarks).
Option 3: Move the files
If you can’t change the balloon content, you can still correct it by moving the resources it points to into the correct locations. Depending on the URL, there are a couple of ways to do this. In our example, you’d move or copy the “images” folder and its contents to the KMZ archive. If the offending URL was “../files/another_image.png” (which should have been “../../files/another_image.png”), you could move or copy the files folder into the somelayer folder to fix the problem.
In many cases, though, there will be many layers all referencing the files folder, so moving the files folder into each layer folder can get tedious. If you have access to the web server configuration, you can solve this by adding an HTTP redirect from each incorrect location that redirects up a directory. You could also move the KMZ file up a directory, but this will change the URL that people must use to access your KMZ file.
I wanted to look at your KML to see if it was properly formatted and test it on my end.

How to link to local images on Node.js version of Tiddlywiki?

I'm using the Node.js version of TiddlyWiki, and I'd like to link to images on my filesystem.
The documentation listed here doesn't work; in the [img[path]] tag, for the path part I put something like /Users/documents/ken/path_to_image.jpg yet nothing shows up in the tiddler.
My wiki exists in /Users/documents/ken/wiki.
I know this is an old post, but zacts stated that you can use a macro plugin or simply use the [img] tag to point to the relative path of the image from the tiddlywiki.html file, but the op is using the node.js version, and zacts apparently didn't read that. There is no tiddlywiki.html file for TiddlyWiki on node.js. That only works with the static .html version of tiddlywiki, not the node.js version.
Currently there is no way to point to a local file through the node.js version of Tiddlywiki as node.js is not a webserver, therefore it does not see subfolders like /images/ off of the root url. The only way is to run a parallel web server on the same machine and use the full web url to the images served up from the web server.
In case someone else stumbles across this problem:
I could not find this documented anywhere, but what seems to work is to just copy the image in the tiddlers directory, then restart the nodejs server, and search for the image title from tiddlywiki. There will be a tiddler that contains that image, that you can edit at your leisure.
Alternatively, copy the image as image_name.png (or image_name.jpg) into the tiddlers directory, and create a image_name.png.meta text file with the following contents:
title: image_name
type: image/jpeg
Upon restart of the tiddlywiki nodejs server, a tiddler with title image_name which contains the image will be there.
If you are using the Node.js version, you can simply put it in the ./files folder, and then use [img[. /files/xxx.jpg]] to reference it.
I had this same issue recently, and I found a neat little solution for it. Let me send you the links, and I'll post the snippets here.
I happened to stumble across this tiddlywiki image gallery homepage that linked to a macro plugin that lets you link in local images. Here is the link to the tiddler for the plugin: http://www.richshumaker.com/tw5/tw-photo.html#External%20Image%20Path. Here is the original TiddlyWiki google groups post of the plugin for this: https://groups.google.com/forum/#!msg/tiddlywiki/ChRV6sjQpn4/bCm35_XhGmkJ.
I hope this helps! =) (note: when I get more time I may clean up the formatting of this post).
It is very simple, you use _canonical_uri field
_canonical_uri field
The field value is something like "./wiki/path_to_image.jpg" (mine is "./files") in the same level as the tiddlers folder. I did not experimented with files outside the root folder of the wiki. The dot in the path might be ommited.
The content type might be "audio/mp3" "image/jpg" look at the "parser" shadow tiddlers. Your Browser might support more content types like "audio/wav" but you would have to add this line to "$:/core/modules/parsers/audioparser.js" For example. Might be the same thing for images. Check your browser support.
I really do not know why this fact is so obscure, but it work wonders.

How to determine real format of an XLSX Excel file?

I have a well known problem that is described in Extension Warning On Opening Excel Workbook from a Web Site microsoft blog entry. I've added URL rewrite to have URL nicely formatted and my mime type matches exactly XLSX recommended file type. However I still get a warning. I suspect that service that provides me those xlsx files mismatches real file format and extension.
Is there a way to determine real xlsx file format? Something that would say what is the native extension for particular Excel file.
Thanks in advance.
Have you tried changing the mime header from vnd:excel to octet-stream? This will still bring Excel up, albeit not embedded into IE, which vnd:excel does (but I hate vnd:excel anyways because embedding the spreadsheet into the browser screws up the form flow of my web apps).
Did not find an answer for that anyway.
However I've discovered the reason why I get a warning from Excel - any parameter in query string will trigger such a warning, even for static files:
http://localhost/1.xls
works ok
http://localhost/1.xls?testparam=paramvalue
gives a warning.
Will use URL rewrite to encode parameters.

Site Error File Does Not Exist

I used http://site-perf.com/ to test the speed of my site (http://sweatingthebigstuff.com) and it shows one file that gives a 404 error. That file does not exist (hence the error), but how do I found out how to fix it? I don't know where it is being called (definitely not in the code).
The file in question is:
sweatingthebigstuff.com/wp-content/themes/WillTech_5_3_2010/lib/images/icon-rss.gif
I assume that I used to have a file but since deleted it. It was in a widget and it is now pointing to a png file.
Any ideas?
It was in a widget and it is now pointing to a png file.
There is a reference to it somewhere - in a forgotten HTML file, in a style sheet.... The easiest might be doing a full-text search for your whole (local) Wordpress directory for icon-rss.gif.
If that doesn't turn up anything - it should, though! - try using a downloader like GetLeft to fetch a full HTML copy of your site, and do a full text search on that. That should at least show you which page the offending line is on.

Resources