次の方法で共有


WinJS.Fragments.render function

Loads the contents of the specified Uniform Resource Identifier (URI) into the specified element.

Note  Subsequent calls to render will not reload the URI. Instead, it will use a cached copy.

 

Syntax

WinJS.Fragments.render(href, target).done( /* Your success and error handlers */ );

Parameters

  • href
    Type: String

    The URI that contains the fragment to copy.

  • target
    Type: HTMLElement

    Optional. The element to which the fragment is appended.

Return value

Type: Promise**

A promise that is fulfilled when the fragment has been loaded. If a target element isn't specified, the copied fragment is the completed value. The fragment isn't added to the cache. For a similar function where the fragment is added to the cache, see renderCopy.

Remarks

Cascading Style Sheets (CSS) and script blocks that are loaded from fragments are added to the document, and won't be removed even if the fragment is unloaded.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Fragments

See also

Samples

Loading HTML fragments sample (Windows)