How to load a local Test.html file inside a iframe in the Blazor server template

1.8k Views Asked by At

I cant figure out how to load a local file into my Blazor Server template. I want to load the Test.html file inside a iframe on the Index.razor page of the template. The Test.html file is saved inside the same folder than the Index.razor file. But it wouldnt show? How to do it right?

@page "/"

<h1>Main Blazor</h1>

<iframe src="Test.html" width="600" height="800" frameborder="0"></iframe>

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I did get it to work by doing this:

Dont put the test.html inside the Page-Folder from Blazor instead put it in the wwwroot folder (to be more oderly I created a folder there "MyHtmlPages") And moved the test file there.

And this is the html from my blazor index.razor page that calls/shows the file successfully:

<iframe src="/MyHtmPages/Test.html" width="600" height="800" frameborder="0"></iframe>