I want to see if the current tab is a PDF file from a background page.
I can check the url for .pdf at the end but there are some PDF files that don’t have that.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t get it using current Chrome API afaik. What you can do is load this page again through XHR and check returned content-type header. Something like this:
background html:
manifest.json:
For PDF files returned content type should be
application/pdf. Something to keep in mind though is that content-type header could contain encoding as well:text/html; charset=UTF-8.