<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nafkha-Med Amine</title>
    <description>The latest articles on DEV Community by Nafkha-Med Amine (@aminenafkha1).</description>
    <link>https://dev.to/aminenafkha1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F992425%2F7c2abdb3-8d89-4e33-b475-d52459aa5d47.jpeg</url>
      <title>DEV Community: Nafkha-Med Amine</title>
      <link>https://dev.to/aminenafkha1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aminenafkha1"/>
    <language>en</language>
    <item>
      <title>Integration Azure Speech Recongition with Blazor and .NET 8</title>
      <dc:creator>Nafkha-Med Amine</dc:creator>
      <pubDate>Wed, 10 Jan 2024 12:53:55 +0000</pubDate>
      <link>https://dev.to/aminenafkha1/integration-azure-speech-recongition-with-blazor-and-net-8-3i3</link>
      <guid>https://dev.to/aminenafkha1/integration-azure-speech-recongition-with-blazor-and-net-8-3i3</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome to an in-depth guide on integrating Azure Speech-to-Text into your Blazor applications. This article aims to provide a comprehensive walkthrough, allowing you to harness the power of speech recognition technology seamlessly within the dynamic Blazor framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;List the prerequisites, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure subscription with Speech resource&lt;/li&gt;
&lt;li&gt;Visual Studio or Visual Studio Code installed&lt;/li&gt;
&lt;li&gt;Basic knowledge of Blazor and C#&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Set Up Azure Resources
&lt;/h2&gt;

&lt;p&gt;1.1 &lt;strong&gt;Create an Azure Speech Resource:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fogt7p90xnteec4b1mrhi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fogt7p90xnteec4b1mrhi.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4le7nyk2jbr2mrx96utf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4le7nyk2jbr2mrx96utf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F676slwq382h6zqktjjg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F676slwq382h6zqktjjg4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp976mjg55sn62rg3qpgq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp976mjg55sn62rg3qpgq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1.2 &lt;strong&gt;Retrieve Subscription Key and Region:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Steps to find the subscription key and region in the Azure Portal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foa6fjks4nlizp517abne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foa6fjks4nlizp517abne.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Create a .NET Blazor App
&lt;/h2&gt;

&lt;p&gt;2.1 &lt;strong&gt;Create a New Blazor WebAssembly Or Server App:&lt;/strong&gt; &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

dotnet new blazorwasm -n YourBlazorWasmApp
cd YourBlazorWasmApp


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2.2 &lt;strong&gt;Install Azure Speech SDK:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Install-Package Microsoft.CognitiveServices.Speech&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Implement Speech-to-Text &amp;amp;&amp;amp; Text-to-Speech
&lt;/h2&gt;

&lt;p&gt;3.1 &lt;strong&gt;Configure Speech Service in &lt;code&gt;Program.cs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code snippet for configuring the Speech service in the Blazor app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.2 &lt;strong&gt;Create a Speech-to-Text &amp;amp;&amp;amp; Text-to-Speech Components :&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

 @using Microsoft.CognitiveServices.Speech
@using Microsoft.CognitiveServices.Speech.Audio
@using Radzen.Blazor
 &amp;lt;RadzenRow&amp;gt;

    &amp;lt;RadzenColumn Size="6"&amp;gt;
        &amp;lt;RadzenSpeechToTextButton Change="OnSpeechCaptured"  /&amp;gt;
        &amp;lt;RadzenTextArea @bind-Value=@Inputvalue   Style="margin-top:15px"   /&amp;gt;
    &amp;lt;/RadzenColumn&amp;gt;
&amp;lt;/RadzenRow&amp;gt;

@code {
    string? Inputvalue; 



    async void OnSpeechCaptured( string text )
    { 
        var config = SpeechConfig.FromSubscription("YourSpeechSubscriptionKey", "YourSpeechRegion");
        config.SpeechSynthesisLanguage = "en-US";

        using var audioConfig = AudioConfig.FromDefaultMicrophoneInput();
        using var speechRecognizer = new SpeechRecognizer(config, audioConfig);
        var speechRecongResult = await speechRecognizer.RecognizeOnceAsync();
        OutputSpeechRecognitionResult(speechRecongResult); 
    }

    public void OutputSpeechRecognitionResult(SpeechRecognitionResult speechRecognitionResult)
    {
        switch (speechRecognitionResult.Reason)
        {
            case ResultReason.RecognizedSpeech:
                Inputvalue = speechRecognitionResult.Text;
                break;
            case ResultReason.NoMatch:
                Inputvalue = "NOMATCH: Speech could not be recognized.";

                break;
            case ResultReason.Canceled:
                var cancellation = CancellationDetails.FromResult(speechRecognitionResult);
                 Inputvalue = $"CANCELED: Reason={cancellation.Reason}";

                if (cancellation.Reason == CancellationReason.Error)
                {
                    Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
                    Console.WriteLine($"CANCELED: ErrorDetails={cancellation.ErrorDetails}");
                    Console.WriteLine($"CANCELED: Did you set the speech resource key and region values?");
                }
                break;
        }
    }
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@using Microsoft.CognitiveServices.Speech
@using Microsoft.CognitiveServices.Speech.Audio
@using Radzen.Blazor
 &amp;lt;RadzenRow&amp;gt;

    &amp;lt;RadzenColumn Size="6"&amp;gt;
        &amp;lt;RadzenSpeechToTextButton Change="OnSpeechCaptured"  /&amp;gt;
        &amp;lt;RadzenTextArea @bind-Value=@Inputvalue   Style="margin-top:15px"   /&amp;gt;
    &amp;lt;/RadzenColumn&amp;gt;
&amp;lt;/RadzenRow&amp;gt;

@code {
    string? Inputvalue; 



    async void OnSpeechCaptured( string text )
    { 
        var config = SpeechConfig.FromSubscription("YourSpeechSubscriptionKey", "YourSpeechRegion");
        config.SpeechSynthesisLanguage = "en-US";

        using var audioConfig = AudioConfig.FromDefaultMicrophoneInput();
        using var speechRecognizer = new SpeechRecognizer(config, audioConfig);
        var speechRecongResult = await speechRecognizer.RecognizeOnceAsync();
        OutputSpeechRecognitionResult(speechRecongResult); 
    }

    public void OutputSpeechRecognitionResult(SpeechRecognitionResult speechRecognitionResult)
    {
        switch (speechRecognitionResult.Reason)
        {
            case ResultReason.RecognizedSpeech:
                Inputvalue = speechRecognitionResult.Text;
                break;
            case ResultReason.NoMatch:
                Inputvalue = "NOMATCH: Speech could not be recognized.";

                break;
            case ResultReason.Canceled:
                var cancellation = CancellationDetails.FromResult(speechRecognitionResult);
                 Inputvalue = $"CANCELED: Reason={cancellation.Reason}";

                if (cancellation.Reason == CancellationReason.Error)
                {
                    Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
                    Console.WriteLine($"CANCELED: ErrorDetails={cancellation.ErrorDetails}");
                    Console.WriteLine($"CANCELED: Did you set the speech resource key and region values?");
                }
                break;
        }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3.3 &lt;strong&gt;Handle Configuration:&lt;/strong&gt;&lt;br&gt;
  In the last provided code snippet , you will notice two placeholders: "YourSpeechSubscriptionKey" and "YourSpeechRegion". These placeholders act as placeholders for your actual Azure Speech resource information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Run and Test
&lt;/h2&gt;

&lt;p&gt;4.1 &lt;strong&gt;Run the Blazor App:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet run&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
4.2 &lt;strong&gt;Test Speech-to-Text &amp;amp;&amp;amp; Text-to-Speech:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdxl78700emqp5avbhm4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdxl78700emqp5avbhm4z.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sharing Data between Blazor and JavaScript ( JS interop )</title>
      <dc:creator>Nafkha-Med Amine</dc:creator>
      <pubDate>Sat, 03 Jun 2023 13:45:16 +0000</pubDate>
      <link>https://dev.to/aminenafkha1/sharing-data-between-blazor-and-javascript-js-interop--42ef</link>
      <guid>https://dev.to/aminenafkha1/sharing-data-between-blazor-and-javascript-js-interop--42ef</guid>
      <description>&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
In the ever-evolving landscape of web development, developers are constantly seeking ways to leverage the strengths of different technologies and frameworks. One powerful combination that has emerged is the integration of Blazor, a framework for building web applications using C#, with JavaScript, the ubiquitous language of the web. This integration opens up a world of possibilities, allowing developers to seamlessly share data between Blazor components and JavaScript code.&lt;/p&gt;

&lt;p&gt;Sharing data between Blazor and JavaScript is not just a mere technicality; it represents a bridge that connects the robust, type-safe world of C# with the extensive JavaScript ecosystem. It enables developers to harness the power of existing JavaScript libraries, access browser APIs, and collaborate with JavaScript-only components, all while enjoying the declarative programming model and familiarity of C#.&lt;/p&gt;

&lt;p&gt;In this article, we will dive deep into the realm of data sharing between Blazor and JavaScript. We will explore the what, why, and how of sharing data.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps :
&lt;/h2&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;p&gt;we will walk through a series of use cases that demonstrate the seamless sharing of data between Blazor and JavaScript : &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Setting up the Project
&lt;/h2&gt;

&lt;p&gt;To set up JavaScript interop in your Blazor project, you need to follow a few steps. First, create a folder named js (or any other name you prefer) inside the wwwroot folder. This folder will store your JavaScript interop files.&lt;/p&gt;

&lt;p&gt;Inside the js folder, create individual JavaScript files for each JavaScript interop functionality you want to include. For example, you can have myInterop.js, otherInterop.js, etc. These files will contain the JavaScript functions and event handlers you want to interact with from your Blazor components.&lt;/p&gt;

&lt;p&gt;In your Blazor component, use the @inject directive to inject the IJSRuntime dependency. This allows you to interact with JavaScript code from your Blazor component. For example, you can call JavaScript functions, handle JavaScript events, and pass data between JavaScript and Blazor.&lt;/p&gt;

&lt;p&gt;To include the JavaScript interop files in your Blazor application, add a reference to the JavaScript files in the _Host file located in the Pages folder. Use the script tag and provide the relative path to the JavaScript file. This ensures that the JavaScript code is loaded when the application starts.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Defining the JsonSerializable Class :
&lt;/h2&gt;

&lt;p&gt;Provide the code for the "JsonSerializable" class, which facilitates serialization and deserialization of objects. Emphasize its role in converting objects to JSON format and vice versa.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

public interface IJsonSerializable
    {
        string ToJson();
    }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

public class JsonSerializable : IJsonSerializable
{
    public string ToJson()
    {
        return JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore
        });
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  3. Creating the Employee Class :
&lt;/h2&gt;

&lt;p&gt;Introduce the "Employee" class as an example data model that inherits from the "JsonSerializable" class. the class and its properties, such as "Name" and "Age," which will be used for data sharing.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

public class Employee : JsonSerializable
{
    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("age")]
    public int Age { get; set; }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  4.Use Cases :
&lt;/h2&gt;

&lt;p&gt;Here are the JavaScript interop cases with examples that you can include  : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handling JavaScript events in Blazor : &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@inject IJSRuntime jsRuntime

&amp;lt;p&amp;gt;Received employee from JavaScript: &amp;lt;span&amp;gt;@employee.Name @employee.Age &amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;

@code {

    [JSInvokable]
    public void ReceiveEmployeeFromJavaScript(string employeeJson)
    {
        var employee = JsonConvert.DeserializeObject&amp;lt;Employee&amp;gt;(employeeJson);

    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await jsRuntime.InvokeVoidAsync("myJavaScriptFunctionWithCallback", DotNetObjectReference.Create(this));
        }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

function myJavaScriptFunctionWithCallback(dotnetReference) {
    const employee = {
        name: "Amine Nafkha",
        age: "2000-08-02"
    };
    const employeeJson = JSON.stringify(employee);
dotnetReference.invokeMethodAsync("ReceiveEmployeeFromJavaScript", employeeJson);
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt; Calling JavaScript functions from Blazor&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@inject IJSRuntime jsRuntime

&amp;lt;button @onclick="async () =&amp;gt; await jsRuntime.InvokeVoidAsync("myJavaScriptFunction", employee.ToJson())"&amp;gt;Call JavaScript Function&amp;lt;/button&amp;gt;

@code {
    private Employee employee = new Employee
    {
        Name = "Amine Nafkha",
        Age = new DateTime(2000, 8, 2)
    };
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Manipulating the DOM from Blazor 
Defining the ChangeButtonColor Method:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

@inject IJSRuntime jsRuntime

&amp;lt;button @onclick="() =&amp;gt; ChangeButtonColor()"&amp;gt;Change Button Color&amp;lt;/button&amp;gt;


@code {
    private async Task ChangeButtonColor()
    {
        await jsRuntime.InvokeVoidAsync("changeButtonColor");
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

Implementing the changeButtonColor JavaScript Function: 
function changeButtonColor() {
    const button = document.querySelector('button');
    button.style.backgroundColor = 'red';
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt; Interop with third-party JavaScript libraries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Blazor's JavaScript Interop feature opens up a world of possibilities for integrating various third-party JavaScript libraries into your applications. One popular library is ApexCharts, which provides feature-rich and interactive charting capabilities. With Blazor's Interop, you can seamlessly utilize ApexCharts within your Blazor components to create stunning visualizations. Here's an example code snippet showcasing the integration of ApexCharts in Blazor:&lt;/p&gt;

&lt;p&gt;Create a new JavaScript file, for example, chartInterop.js, in your project's wwwroot/js folder. This file will contain the JavaScript code for rendering the ApexCharts. :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzieoh3zwln89qle3pkkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzieoh3zwln89qle3pkkn.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2bpcv8qjgoy96t77lgm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2bpcv8qjgoy96t77lgm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the _Host  file located in the Pages folder, and add the following line to import the JavaScript file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcras3lqbw8wscmgqxk4i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcras3lqbw8wscmgqxk4i.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In your Blazor component, inject the IJSRuntime service and invoke the JavaScript function : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mf6k6dvvnv96ku41ui8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mf6k6dvvnv96ku41ui8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqg2nkm8k9l6fwk9fbive.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqg2nkm8k9l6fwk9fbive.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blazor</category>
      <category>csharp</category>
      <category>dotnet</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
