1

Suppose I have a .NET web application that contains two panes. One pane is a viewer capable of displaying a variety of large file types. The other pane contains an arbitrary list of files, e.g. file1.docx, file2.xlsx, file3.pptx, file4.txt, file5.doc, file6.htm, file7.zxz, file8.exe etc.

The user is capable of selecting any file in the list and displaying it in the adjacent pane when the selection changes, presumably via client-side Javascript. Given the user has selected some file, e.g. file1.docx, is there a way to prefetch/preload some number of files in the list, e.g. file2.xlsx and file3.pptx while the user is viewing file1.docx?

If this could be done in the background with an asynchronous Ajax-like call, it would make the application appear faster for users who went from file to file in sequence. I am assuming that the prefetch call could be smart enough not to attempt to request files that could not be viewed, e.g. exe files.

Any help or examples would be much appreciated.

  • It's been almost 5 years since I asked this question, and I can no longer remember the issue that led me to ask the question. but I do appreciate the answer Paul gave, and the fact that others found the question and answer of value. – Jeffrey Roughgarden Jun 09 '16 at 02:01

1 Answers1

1

Use hidden iframes to load subsequent documents after the first click. Use a plugin detection script to check file extension support prior to allowing the click event. If you want to prerender, then use each browsers prefetch API:

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265