1 Answers
In general, browsers will try to detect the MIME type of an object (set by metadata "Content-Type") to decide what do to with it. If an object has an undetermined/unknown MIME type to the browser, it will simply download that object as "regular file", rather than processing it (open, play, etc.).
So depends on your objects, you need to set their MIME accordingly. For example:
PDF objects need to have MIME type as
application/pdf
so that browsers can open them directly.Regular text objects need to have MIME type as
text/plain
so browsers can display it without downloading.etc.
You can use either the Console or gsutil to set the metadata for objects in bucket. Here’s an example with gsutil for PDF file:
gsutil setmeta -h "Content-Type:application/pdf" gs://my-example-bucket/my-document.pdf