ScriptTagHelper ScriptTagHelper ScriptTagHelper Class

Definition

ITagHelper implementation targeting <script> elements that supports fallback src paths.

[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-src-include")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-src-exclude")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-fallback-src")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-fallback-src-include")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-fallback-src-exclude")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-fallback-test")]
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElement("script", Attributes="asp-append-version")]
public class ScriptTagHelper : Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
type ScriptTagHelper = class
    inherit UrlResolutionTagHelper
Public Class ScriptTagHelper
Inherits UrlResolutionTagHelper
Inheritance
Attributes

Remarks

The tag helper won't process for cases with just the 'src' attribute.

Constructors

ScriptTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory) ScriptTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory) ScriptTagHelper(IHostingEnvironment, IMemoryCache, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory)

Creates a new ScriptTagHelper.

ScriptTagHelper(IHostingEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory) ScriptTagHelper(IHostingEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory) ScriptTagHelper(IHostingEnvironment, TagHelperMemoryCacheProvider, IFileVersionProvider, HtmlEncoder, JavaScriptEncoder, IUrlHelperFactory)

Creates a new ScriptTagHelper.

Properties

AppendVersion AppendVersion AppendVersion

Value indicating if file version should be appended to src urls.

Cache Cache Cache
FallbackSrc FallbackSrc FallbackSrc

The URL of a Script tag to fallback to in the case the primary one fails.

FallbackSrcExclude FallbackSrcExclude FallbackSrcExclude

A comma separated list of globbed file patterns of JavaScript scripts to exclude from the fallback list, in the case the primary one fails. The glob patterns are assessed relative to the application's 'webroot' setting. Must be used in conjunction with FallbackSrcInclude.

FallbackSrcInclude FallbackSrcInclude FallbackSrcInclude

A comma separated list of globbed file patterns of JavaScript scripts to fallback to in the case the primary one fails. The glob patterns are assessed relative to the application's 'webroot' setting.

FallbackTestExpression FallbackTestExpression FallbackTestExpression

The script method defined in the primary script to use for the fallback test.

GlobbingUrlBuilder GlobbingUrlBuilder GlobbingUrlBuilder
HostingEnvironment HostingEnvironment HostingEnvironment
HtmlEncoder HtmlEncoder HtmlEncoder Inherited from UrlResolutionTagHelper
JavaScriptEncoder JavaScriptEncoder JavaScriptEncoder
Order Order Order
Src Src Src

Address of the external script to use.

SrcExclude SrcExclude SrcExclude

A comma separated list of globbed file patterns of JavaScript scripts to exclude from loading. The glob patterns are assessed relative to the application's 'webroot' setting. Must be used in conjunction with SrcInclude.

SrcInclude SrcInclude SrcInclude

A comma separated list of globbed file patterns of JavaScript scripts to load. The glob patterns are assessed relative to the application's 'webroot' setting.

SuppressFallbackIntegrity SuppressFallbackIntegrity SuppressFallbackIntegrity

Boolean value that determines if an integrity hash will be compared with FallbackSrc value.

UrlHelperFactory UrlHelperFactory UrlHelperFactory Inherited from UrlResolutionTagHelper
ViewContext ViewContext ViewContext Inherited from UrlResolutionTagHelper

Methods

Init(TagHelperContext) Init(TagHelperContext) Init(TagHelperContext)

Initializes the ITagHelper with the given context. Additions to Items should be done within this method to ensure they're added prior to executing the children.

(Inherited from TagHelper)
Process(TagHelperContext, TagHelperOutput) Process(TagHelperContext, TagHelperOutput) Process(TagHelperContext, TagHelperOutput)
ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput)

Asynchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)
ProcessUrlAttribute(String, TagHelperOutput) ProcessUrlAttribute(String, TagHelperOutput) ProcessUrlAttribute(String, TagHelperOutput)

Resolves and updates URL values starting with '~/' (relative to the application's 'webroot' setting) for output's Attributes whose Name is attributeName.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, IHtmlContent) TryResolveUrl(String, IHtmlContent) TryResolveUrl(String, IHtmlContent)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)
TryResolveUrl(String, String) TryResolveUrl(String, String) TryResolveUrl(String, String)

Tries to resolve the given url value relative to the application's 'webroot' setting.

(Inherited from UrlResolutionTagHelper)

Applies to