Opened 10 years ago

Closed 10 years ago

#191 closed defect (fixed)

calling Scholar.Attachments.importFromURL on a PDF without PDF plug-in installed results in a prompt to save the file to the disk

Reported by: simon Owned by: dstillman
Priority: minor Milestone: 1.0 Beta 1
Component: data layer Version: 1.0
Keywords: Cc:

Description

probably not too big of an issue, bc we can just convince people they should have the PDF plug-in installed, but this might be worth fixing if you have the time.

you can definitely intercept the request before it gets to the file dialog, but that might require registering an nsIURIContentListener and an nsIStreamListener, which isn't fun (see the EndNote interceptor code in ingester.js). you could also run a head request and do an XMLHttpRequest for non-HTML documents, or do some black magic with channels.

Change History (1)

comment:1 Changed 10 years ago by dstillman

  • Resolution set to fixed
  • Status changed from new to closed

(In [507]) Fix #191, calling Scholar.Attachments.importFromURL on a PDF without PDF plug-in installed results in a prompt to save the file to the disk

Attachments.importFromURL() now first does a HEAD request to get the MIME type and passes that through Scholar.MIME.hasInternalHandler() (now abstracted from Scholar.File, along with the other MIME functions) -- if it can handle the MIME type, it uses a hidden browser; otherwise, it use a remote web page persist to save the file directly

Note: See TracTickets for help on using tickets.