xml3d / xml3d-stl-plugin

Plugin to use STL models as external mesh references
MIT License
3 stars 1 forks source link

Loading STL from local file works only in firefox #3

Open chriscarex opened 8 years ago

chriscarex commented 8 years ago

Hi, I am having an issue while loading a local file. In Firefox everything works fine, the same file loaded in Chrome or Explorer gives: Content-Type: application/netfabb instead of Content-Type: application/vnd.ms-pki.stl as you explain in the description. Any ideas on how I can solve the problem? All the best, Christian

chriscarex commented 8 years ago

I read about mimetypes and the same file can have different mimetypes according to browser settings, is that correct? I think it should be made possible either to: 1) change mimetype after the file is loaded (which I suppose cannot be done); 2) increase the range of supported mimetypes. Let me know if you can solve this issue or provide some hints. Thanks!

csvurt commented 8 years ago

Hi, mimetypes are pretty complicated. They depend on your server settings, browser and sometimes even on other settings inside your OS. On Windows for example they're also defined in the system registry and any program can change them. For this reason it's hard to come up with a mimetype check that will work in all cases. Changing it after the file is loaded is tough too because for that we'd need to know what kind of file it is, and if we know that then we don't need the mimetype anyway ;)

We're working on improving this whole system as part of the 5.1 release of XML3D, it'll get better but there will always be some edge cases that it fails on.

For now you can change the isFormatSupported function in the plugin to also check for the other mimetype, or to check for an .stl file ending if the mimetype check fails. Probably we'll do this as part of the 5.1 release too.