Closed
Description
Describe the bug
Having an iframe where the src
attribute is modified within an InvokeAsync
block impairs the "One Page Back"-button experience: If you click the button in firefox (75.0), the iframe appears to reload, but you are not redirected to the previous page.
In Edge and Chrome it works fine. In IE11 my sample throws an ObjectDisposedException
, which is most likely a different bug I guess?
To Reproduce
Either clone this repo, or use this snippet:
@page "/i/iframe"
@using System.Diagnostics
@if (Url != null)
{
<iframe src="@(Url)" style="width:100%; height:100%; border:0; border-style:solid;" />
}
else
{
<div>Url is null</div>
}
@code {
[Parameter]
public string? SomeString { get; set; }
string? Url = null;
protected override void OnParametersSet()
{
Task.Run(async () =>
{
await InvokeAsync(() =>
{
Url = "https://demo.codimd.org/CGdlv3HDQwaQe_Y6uWKLhw";
base.StateHasChanged();
});
});
}
}
Open firefox and the index page, click on "iframe" to navigate to /i/iframe
, wait for iframepage and the actual iframe to load, press the back button once, and you will see that your browser does not navigate to the previous page.
Further technical details
- ASP.NET Core version
3.1.3
- Include the output of
dotnet --info
PS C:\Users\Benni\repositories\BlazorServerIframeBug> dotnet --info
.NET Core SDK (gemäß "global.json"):
Version: 3.1.201
Commit: b1768b4ae7
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.203 [C:\Program Files\dotnet\sdk]
3.0.100-preview9-014004 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.200 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
- The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
Microsoft Visual Studio Enterprise 2019 Version 16.5.4