Bug 64934 - [Mac] Embedding PDF with <object> or <embed> fails when there is no MIME type specified
Summary: [Mac] Embedding PDF with <object> or <embed> fails when there is no MIME type...
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac All
: P2 Normal
Assignee: Alexey Proskuryakov
Keywords: InRadar
Depends on:
Reported: 2011-07-21 05:23 PDT by lvschie
Modified: 2011-10-11 22:43 PDT (History)
2 users (show)

See Also:

proposed fix (1.55 KB, patch)
2011-10-11 11:51 PDT, Alexey Proskuryakov
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lvschie 2011-07-21 05:23:01 PDT
In Safari 5.1 and the most recent versions of WebKit the embedding of PDF's in the HTML tags OBJECT or EMBED fail (at least under Lion) and display the message "Missing plugin". In earlier versions of Safari (5.0x and lower) this worked like a charm. This is a major issue for us, because our software relies heavily on this and there are not alternatives available for Lion yet (Acrobat PDF plugin not supported onder OS X 10.7 Lion). It seems that the embedded PDF viewer only displays PDF's that are loaded directly into a page correctly, but not those embedded in the OBJECT and/or EMBED tags.

Example of code: 

< object data="file.pdf" width="80%" height="80%" type="application/pdf" >Object embed not supported by this browser < /object >


< embed src="file.pdf" width="80%" height="80%" >< /embed >

Example of website that shows the issue:

Comment 1 Alexey Proskuryakov 2011-07-21 11:05:29 PDT
Comment 2 lvschie 2011-07-28 07:41:01 PDT
I sure hope that either you guys at Webkit, or Apple, fix this issue. It's driving me nuts, to say the least.
Comment 3 Alexey Proskuryakov 2011-10-11 11:46:43 PDT
This largely works in nightlies already. One exception is the latter example, where <embed> doesn't have a type. Patch forthcoming.
Comment 4 Alexey Proskuryakov 2011-10-11 11:51:43 PDT
Created attachment 110552 [details]
proposed fix
Comment 5 mitz 2011-10-11 11:56:01 PDT
Comment on attachment 110552 [details]
proposed fix

View in context: https://bugs.webkit.org/attachment.cgi?id=110552&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:336
> +            || (parameters.mimeType.isEmpty() && parameters.url.string().lower().endsWith(".pdf")))

This should check the path component of the url rather than the whole string.
Comment 6 Alexey Proskuryakov 2011-10-11 12:00:54 PDT
Committed <http://trac.webkit.org/changeset/97167>.
Comment 7 lvschie 2011-10-11 22:43:53 PDT
Great, it works partially. Only thing missing now are the zoom, download and page forward/back buttons when a PDF is loaded. I assume that these will be visible when Mac OS X 10.7.2 is launched?