I have created a sample blazor webAssembly applcation and wanted to load that in the container app created in blazor standalone webassembly.
I am using iframe to load the child app however it shows
chromewebdata/:1 Refused to display 'https://localhost:7239/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
my code
@page "/"
<h3>Main Container Application</h3>
<iframe width="560" height="315" src="https://localhost:7239/" frameborder="0"></iframe>
I have created a sample blazor webAssembly applcation and wanted to load that in the container app created in blazor standalone webassembly.
I am using iframe to load the child app however it shows
chromewebdata/:1 Refused to display 'https://localhost:7239/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
my code
@page "/"
<h3>Main Container Application</h3>
<iframe width="560" height="315" src="https://localhost:7239/" frameborder="0"></iframe>
Share
Improve this question
asked Mar 18 at 7:03
Talal HabibTalal Habib
212 bronze badges
1 Answer
Reset to default 0In the program.cs
of "server project" in frame website WebApp (https://localhost:7239/), add following code to remove "X-Frame-Options" header will solve this issue.
app.Use(async (context, next) =>
{
context.Response.Headers.Remove("X-Frame-Options");
await next();
});
app.MapRazorComponents<App>()
...