Movatterモバイル変換


[0]ホーム

URL:


PDF
Edit
Suggest a Feature

    Reference scripts in Blazor applications

    12 Dec 202513 minutes to read

    This page explains script isolation and how to reference Syncfusion® Blazor scripts from the CDN, static web assets, and the Custom Resource Generator (CRG).

    NOTE

    JavaScript interop files are required for features that cannot be implemented natively in Blazor.

    CDN reference

    You can refer the Syncfusion® Blazor scripts using the CDN resources.

    • For.NET 8, .NET 9 and .NET 10 Blazor Web App (any render mode: Server, WebAssembly, or Auto), add scripts in~/Components/App.razor.
    • For aBlazor WebAssembly (standalone) App, add scripts in~/wwwroot/index.html.

    Syncfusion® Blazor components are available on the CDN per version. Ensure the version in the URLs matches the NuGet package version used in the application.

    ComponentCDN Script Reference

    All components except PDF Viewer (Classic), PDF Viewer & Document Editor

  • CSHTML
  • https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor.min.js

    PDF Viewer (Classic)

  • CSHTML
  • https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-pdfviewer.min.js

    Document Editor

  • CSHTML
  • https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-documenteditor.min.js

    PDF Viewer

  • CSHTML
  • https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-sfpdfviewer.min.js

    Smart PDF Viewer

  • CSHTML
  • https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-sfsmartpdfviewer.min.js
    <head>    ....<scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor.min.js"type="text/javascript"></script></head>

    If you are usingPDF Viewer (Classic),PDF Viewer,Smart PDF Viewer orDocumentEditor, ensure to add additional script references as follows,

    <head>    ....<scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-pdfviewer.min.js"type="text/javascript"></script><scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-documenteditor.min.js"type="text/javascript"></script><scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-sfpdfviewer.min.js"type="text/javascript"></script><scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/syncfusion-blazor-sfsmartpdfviewer.min.js"type="text/javascript"></script></head>

    Additionally, Syncfusion® Blazor components provides latest scripts in CDN without versioning. You can use this in development environment if you want to always use the latest version of scripts. It is not recommended to use this in production environment.

    ComponentCDN Script Reference
    All components except PDF Viewer (Classic), PDF Viewer & Document Editorhttps://cdn.syncfusion.com/blazor/syncfusion-blazor.min.js
    PDF Viewer (Classic)https://cdn.syncfusion.com/blazor/syncfusion-blazor-pdfviewer.min.js
    Document Editorhttps://cdn.syncfusion.com/blazor/syncfusion-blazor-documenteditor.min.js
    PDF Viewerhttps://cdn.syncfusion.com/blazor/syncfusion-blazor-sfpdfviewer.min.js
    Smart PDF Viewerhttps://cdn.syncfusion.com/blazor/syncfusion-blazor-sfsmartpdfviewer.min.js

    NOTE

    To add custom PDF Viewer script file in your application, referHow to refer SfPdfViewer script file in application.

    NOTE

    To add custom Smart PDF Viewer script file in your application, referHow to refer SfSmartPdfViewer script file in application.

    Static web assets

    You can refer the Syncfusion® Blazor scripts from NuGet packages using static web assets.

    Enable static web assets usage

    To use static web assets, callUseStaticFiles in the app’s~/Program.cs file.

    NOTE

    For aBlazor Web App (interaction mode: Auto) andBlazor WebAssembly App, callUseStaticFiles in theServer project.

    Reference scripts from static web assets

    • Combined scripts are available in theSyncfusion.Blazor.Core package. To refer the script from static web assets, use the code below.

      <head>      ...<scriptsrc="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"type="text/javascript"></script></head>
    • If using thePDF Viewer (Classic),PDF Viewer,Smart PDF Viewer, orDocument Editor components, use the code below to reference scripts from static web assets.

      <head>      ...<scriptsrc="_content/Syncfusion.Blazor.PdfViewer/scripts/syncfusion-blazor-pdfviewer.min.js"type="text/javascript"></script><scriptsrc="_content/Syncfusion.Blazor.WordProcessor/scripts/syncfusion-blazor-documenteditor.min.js"type="text/javascript"></script><scriptsrc="_content/Syncfusion.Blazor.SfPdfViewer/scripts/syncfusion-blazor-sfpdfviewer.min.js"type="text/javascript"></script><scriptsrc="_content/Syncfusion.Blazor.SfSmartPdfViewer/scripts/syncfusion-blazor-sfsmartpdfviewer.min.js"type="text/javascript"></script></head>

      NOTE

      The PDF Viewer and Document Editor component scripts are available in static web assets starting from version 19.3.*.

    Individual component script references

    Syncfusion® Blazor components provides component-wise scripts which can be referenced externally in application. If you are using minimal components, then you can import the selected components scripts via CDN or Static web assets directly without usingCRG instead of referencing single script with all components.

    You can add a component script reference in one of the following ways based on usage,

    UsageScript reference

    Refer from Static web assets

  • CSHTML
  • <head>    ...<!--<scriptsrc="_content/<Packagename>/scripts/<Componentscriptname>" type="text/javascript"></script>--><scriptsrc="_content/Syncfusion.Blazor.Inputs/scripts/sf-textbox.min.js"type="text/javascript"></script></head>

    Refer scripts from CDN

  • CSHTML
  • <head>    ...<!--<scriptsrc="https://cdn.syncfusion.com/blazor/<Version>/<Componentscriptname>" type="text/javascript"></script>--><scriptsrc="https://cdn.syncfusion.com/blazor/32.1.19/sf-textbox.min.js"type="text/javascript"></script></head>

    The following table lists components and their script file names.

    ComponentScript name
    TextBoxsf-textbox.min.js
    NumericTextBoxsf-numerictextbox.min.js
    MaskedTextBoxsf-maskedtextbox.min.js
    Uploadersf-uploader.min.js
    Calendarsf-calendar.min.js
    DatePickersf-datepicker.min.js
    DateTimePickersf-datepicker.min.js
    DateRangePickersf-daterangepicker.min.js
    DiagramComponentsf-diagramcomponent.min.js
    TimePickersf-timepicker.min.js
    AutoCompletesf-dropdownlist.min.js
    ComboBoxsf-dropdownlist.min.js
    DropDownListsf-dropdownlist.min.js
    MultiSelectsf-multiselect.min.js
    DropDownButtonsf-drop-down-button.min.js
    SplitButtonsf-drop-down-button.min.js
    ProgressButtonsf-spinner.min.js
    ListBoxsf-listbox.min.js
    ColorPickersf-colorpicker.min.js
    Signaturesf-signature.min.js
    ContextMenusf-contextmenu.min.js
    Menusf-menu.min.js
    Breadcrumbsf-breadcrumb.min.js
    QueryBuildersf-querybuilder.min.js
    Gridsf-grid.min.js
    Accordionsf-accordion.min.js
    Tabsf-tab.min.js
    Toolbarsf-toolbar.min.js
    Schedulesf-schedule.min.js
    BarcodeGeneratorsf-barcode.min.js
    Mapssf-maps.min.js
    CircularGaugesf-circulargauge.min.js
    LinearGaugesf-lineargauge.min.js
    Chartsf-chart.min.js
    CheckBoxsf-checkbox.min.js
    AccumulationChartsf-accumulation-chart.min.js
    StockChartsf-stock-chart.min.js
    BulletChartsf-bullet-chart.min.js
    Sparklinesf-sparkline.min.js
    TreeMapsf-treemap.min.js
    ProgressBarsf-progressbar.min.js
    SmithChartsf-smith-chart.min.js
    RangeNavigatorsf-range-navigator.min.js
    HeatMapsf-heatmap.min.js
    FileManagersf-filemanager.min.js
    Slidersf-slider.min.js
    Tooltipsf-tooltip.min.js
    ListViewsf-listview.min.js
    DashboardLayoutsf-dashboard-layout.min.js
    Sidebarsf-sidebar.min.js
    TreeViewsf-treeview.min.js
    PivotViewsf-pivotview.min.js
    TreeGridsf-treegrid.min.js
    Spinnersf-spinner.min.js
    Splittersf-splitter.min.js
    Switchsf-switch.min.js
    Toastsf-toast.min.js
    Dialogsf-dialog.min.js
    RichTextEditorsf-richtexteditor.min.js
    InPlaceEditorsf-inplaceeditor.min.js
    Kanbansf-kanban.min.js
    Ganttsf-gantt.min.js
    PdfViewersf-pdfviewer.min.js
    ImageEditorsf-image-editor.min.js
    DocumentEditorsf-documenteditor.min.js
    Pagersf-pager.min.js

    Custom Resource Generator

    Syncfusion® Blazor provides an option to generate component interop scripts using theCustom Resource Generator (CRG) tool. Learn how togenerate component-wise scripts using CRG.

    See also

    Help us improve this page

    Please provide additional information

    Please provide additional information

    Please provide additional information

    Please provide additional information

    Please provide additional information
    Please provide additional information
    ×

    [8]ページ先頭

    ©2009-2025 Movatter.jp