Google Cloud Associate Cloud Engineer — Question 51
You host a static website on Cloud Storage. Recently, you began to include links to PDF files on this site. Currently, when users click on the links to these PDF files, their browsers prompt them to save the file onto their local system. Instead, you want the clicked PDF files to be displayed within the browser window directly, without prompting the user to save the file locally. What should you do?
Answer options
- A. Enable Cloud CDN on the website frontend.
- B. Enable 'Share publicly' on the PDF file objects.
- C. Set Content-Type metadata to application/pdf on the PDF file objects.
- D. Add a label to the storage bucket with a key of Content-Type and value of application/pdf.
Correct answer: C
Explanation
The correct answer is C because setting the Content-Type metadata to application/pdf informs the browser that the file is a PDF, allowing it to display the file directly instead of prompting for download. Options A and B do not address the Content-Type issue, while option D incorrectly suggests using a label rather than the necessary metadata setting.