
Answer-first summary for fast verification
Answer: Set Content-Type metadata to application/pdf on the PDF file objects.
Setting the Content-Type metadata to application/pdf on the PDF file objects informs the browser that the file is a PDF, allowing it to be displayed directly in the browser window. This method is effective because it directly communicates the file type to the browser, enabling the desired behavior. Other options, such as enabling public sharing or using Cloud CDN, do not influence how the browser handles the file. Similarly, adding labels to the storage bucket does not affect the file's content type or its display behavior in the browser.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
At a graphics design studio serving multiple clients, you've developed a static website on Cloud Storage to display your freelance services and portfolio. The portfolio includes PDF files that users can download via links. However, you prefer these PDFs to open directly in the browser window when clicked, rather than prompting a download. How can you achieve this?
A
Enable ‘Share publicly‘ on the PDF file objects.
B
Set Content-Type metadata to application/pdf on the PDF file objects.
C
Use Cloud CDN to cache content.
D
Add a label to the storage bucket with a key of Content-Type and value of application/pdf.
No comments yet.