Posts

Showing posts with the label Mime Types

Correct MIME Type For Favicon.ico?

Answer : When you're serving an .ico file to be used as a favicon, it doesn't matter. All major browsers recognize both mime types correctly. So you could put: <!-- IE --> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /> <!-- other browsers --> <link rel="icon" type="image/x-icon" href="favicon.ico" /> or the same with image/vnd.microsoft.icon , and it will work with all browsers. Note: There is no IANA specification for the MIME-type image/x-icon , so it does appear that it is a little more unofficial than image/vnd.microsoft.icon . The only case in which there is a difference is if you were trying to use an .ico file in an <img> tag (which is pretty unusual). Based on previous testing, some browsers would only display .ico files as images when they were served with the MIME-type image/x-icon . More recent tests show: Chromium, Firefox and Edge are fine with both co...

Content-type To Be Used For Uploading Svg Images To AWS S3

Answer : As you mentioned, the correct Content-Type for SVG files is "image/svg+xml". Even if the AWS console does not provide that value in the Content-Type selection field, you can enter it anyway and S3 will accept it. AWS specifies the following in their API docs for the Content-Type header: A standard MIME type describing the format of the contents. For more information, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17. Type: String Default: binary/octet-stream Valid Values: MIME types Constraints: None For additional details see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html

Android: Let User Pick Image Or Video From Gallery

Answer : Pick Audio file from Gallery: //Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); Pick Video file from Gallery: //Use MediaStore.Audio.Media.EXTERNAL_CONTENT_URI Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI); Pick Image from gallery: //Use MediaStore.Images.Media.EXTERNAL_CONTENT_URI Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Pick Media Files or images: Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/* video/*"); You start the gallery as such: Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); pickIntent.setType("image/* video/*"); startActivityForResult(pickIntent, IMAGE_PICKER_SELECT); then in your onActivityResult y...

Correct Mime Type For .mp4

Answer : According to RFC 4337 § 2, video/mp4 is indeed the correct Content-Type for MPEG-4 video. Generally, you can find official MIME definitions by searching for the file extension and "IETF" or "RFC". The RFC (Request for Comments) articles published by the IETF (Internet Engineering Taskforce) define many Internet standards, including MIME types. video/mp4 should be used when you have video content in your file. If there is none, but there is audio, you should use audio/mp4 . If no audio and no video is used, for instance if the file contains only a subtitle track or a metadata track, the MIME should be application/mp4 . Also, as a server, you should try to include the codecs or profiles parameters as defined in RFC6381, as this will help clients determine if they can play the file, prior to downloading it.

CSS Not Loading Wrong MIME Type Django

Answer : Adding following snippet into settings.py file may fix your problem: import mimetypes mimetypes.add_type("text/css", ".css", True) open your Chrome by F12 Developer Tool and check what you actually received. In my case, the CSS file actually redirected to another page. so MIME is text/html not text/css (My English is not very good.) I ran into this issue during development (production was using Nginx and serving from /static_cdn folder without any issues). The solution came from the Django docs: https://docs.djangoproject.com/en/3.1/howto/static-files/#serving-static-files-during-development from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # ... the rest of your URLconf goes here ... ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

CSS File Blocked: MIME Type Mismatch (X-Content-Type-Options: Nosniff)

Answer : I just ran into the same issue. It appears to be a quirk of Express that can manifest itself for a few different reasons, judging by the number of hits from searching the web for "nodejs express css mime type". Despite the type="text/css" attribute we put in our <link elements, Express is returning the CSS file as Content-Type: "text/html; charset=utf-8" whereas it really should be returning it as Content-Type: "text/css" For me, the quick and dirty workaround was to simply remove the rel= attribute, i.e., change <link rel="stylesheet" type="text/css" href="styles.css"> to <link type="text/css" href="styles.css"> Testing confirmed that the CSS file was downloaded and the styles did actually work, and that was good enough for my purposes. I also removed rel = "stylesheet" , and I no longer get the MIME type error, but the styles are not being loaded Some answ...