-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor excel Addin sample: history.pushState is not a function #509
Comments
I indeed already investigated the issue last year when I created the Blazor Office Add-in Samples as I ran into the same issue where OfficeJS is blocking the history stack like so👇🏻
What is obscure is that there is a check if the host is running in Outlook on Android and if that is NOT the case it will block all access to the history replaceState and pushState. I somehow feel that the intended block would only be if it IS Outlook on Android as personally I can't imagine that it fails on all platforms except on Outlook on Android. As the blocking code was in place, I used the NavigationManager.NavigateTo in the NavMenu.razor file to work around that, but indeed this is much slower than using the history option. From the context of the analysis of the issue the blocking history code was added to support Internet Explorer 11 while today Internet Explorer has been deprecated. There were two options proposed:
Like so:
@AlexJerabek I think you should take this back to the team and investigate if the proposed commit of removing the 5 lines can be implemented as it seems outdated to me given that IE is not to be used anymore (I even think the team stopped testing on IE compatibility) Hope this helps. |
Thank you, I will try the workaround you showed |
@AlexJerabek @aafvstam is there an update here on getting this properly fixed and removing those 5 lines? |
And @RK1PF you might want to reopen this issue just so it can get properly looked at? |
I've ended up using React 😅 |
@RK1PF You reopened, so you still need it (other than my workaround I posted earlier)? I believe to have read that this was fixed, but haven't tried it yet. |
No response for some time, but I'll have a look at this next week (week of April 25th) ... |
Tried it this week (first week of July) and the "issue by design" is still there. There are some ways to workaround mentioned earlier but it feels a bit sketchy. |
Question
I have encountered an issue while developing an Excel add-in using Blazor sample. Specifically, I am having difficulty using client-side routing in my Blazor application when the office.js script from the Office JavaScript API is loaded in the page.
When I attempt to use the NavigationManager.NavigateTo method to navigate to a new page in my application, I receive the following error in the browser console:
Uncaught (in promise) TypeError: history.pushState is not a function
This error occurs only when the office.js script is loaded in the page. When I remove the script, client-side routing works as expected.
I have attempted to work around this issue by using the NavigationManager.NavigateTo method with the forceLoad parameter set to true. This method works, but it is significantly slower than client-side routing, as it requires a full page reload each time a link is clicked.
I believe that this issue may be related to a conflict or compatibility issue between the office.js script and the client-side routing functionality in Blazor. However, I have been unable to identify a specific workaround or solution that allows me to use client-side routing without experiencing the history.pushState error.
Could you please investigate this issue and provide guidance on how to resolve it or optimize the performance of client-side routing in this scenario? I would greatly appreciate any assistance that you can provide.
Thank you for your attention.
The text was updated successfully, but these errors were encountered: