WebPicture.Preload

From Xojo Documentation

Method

WebPicture.Preload() As Boolean

Supported for all project types and targets.

Asks the browser to pre-cache the image.

Notes

This method relies on the current Session context. If there is no active session, this method will return false. Use a WebSessionContext object if you need to preload an image into another session.

Once the image has been loaded by the browser, the Cached property will return true. If the image has already been cached, Preload will do nothing and return true.

You may want to preload images that need to be displayed at a later time so that they will be displayed faster.

Examples

Loads two pictures and preloads them:

Var picFile1 As New FolderItem("MyPicture1.png")
App.Picture1 = New WebPicture(picFile1)
If Not App.Picture1.Preload Then
// Browser was unable to preload the picture
End If

Var picFile2 As New FolderItem("MyPicture2.png")
App.Picture2 = New WebPicture(picFile2)
If Not App.Picture2.Preload Then
// Browser was unable to preload the picture
End If