Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Prefetch content for Windows Store apps

Visual Studio 2015

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Prefetch content for Windows Store apps.

Applies to Windows only](../Image/windows_only_content.png "windows_only_content")

To make your Windows Store app more responsive, you can request Windows to preload some web content, such as web pages or images, into the app's WinINetWinINetcache. This functionality is called prefetching. It’s especially effective for content that's used at startup but you can prefetch other frequently used content, too. The methods of the Windows.Networking.BackgroundTransfer.ContentPrefetcher class let you specify the URIs of the content that you want to preload. See the Windows SDK Content prefetch sample for examples of how to add ContentPrefetcher functionality to your app.

Windows uses heuristics to determine when and if prefetching should occur and which resources will be downloaded. The heuristics take into account system network and power conditions, user app usage history, and the results of prior prefetch attempts. In Visual Studio, you can use the Trigger Windows Store App Prefetch command to force Windows to ignore the ContentPrefetcher heuristics and preload all of the specified web content. This can be useful if you want test the app's behavior or performance with the content to prefetch in a known state (either loaded or not loaded).

This procedure assumes that you have already set up the ContentPrefetcher functionality and specified the content URIs to preload in your app project. To force a preloading of content when the specified resources are new or modified, you have to start and stop the app before you choose the Trigger Windows Store App Prefetch command. You run the app first to register the URIs. Trigger Windows Store App Prefetch command then forces the ContentPrefetcher to download the content and add it the cache. In subsequent runs of the app, you can assume that the content is preloaded.

  1. Start the app to register the prefetch content URIs with the app. On the Debug menu, choose Start Debugging (Keyboard shortcut: F5).

  2. On the Debug menu, choose Stop Debugging (Keyboard shortcut: Shift + F5).

  3. On the Debug menu, choose Other Debug Targets and then choose Trigger Windows Store App Prefetch.

You can now debug, test, or analyze your app with the prefetched web resources.

System_CAPS_ICON_note.jpg Note

Repeat these steps whenever you add or modify the specified web content.

Blog post: Triggering Prefetch for Windows Store Apps in Visual Studio 2013 Update 2

© 2017 Microsoft