vimpr/vimperator-plugins

How to support autoload reasonably?

fno2010 opened this issue · 0 comments

I found matchingUrls (which is the mechanism used by vimperator to implement plugins' autoload) is really not a good idea to autoload plugins. See #117

In the dynamic websites, http servers will use route to select which pages should be rendered. So URL does often not direct a static file.

For example, https://github.com///blob///.pdf will not direct a PDF file. Github will open a webpage with its own online pdf reader to display this PDF file. So PDF.js will not be loaded by FireFox.

But https://raw.githubusercontent.com/////.pdf will response a PDF file via HTTPS. The media type of its HTTPS response is application/pdf. So FireFox will load PDF.js.

I think there are two potential solutions:

  1. Use HTTP header matching (not url matching) to autoload. We can match different mediatype.
  2. Use DOM detecting to autoload. Plugin authors need to define DOM detectors like ftdetect in vim.