Skip to content

Blazor excel Addin sample: history.pushState is not a function #509

Open
@RK1PF

Description

Note: This repo is only for questions related to its samples. If you have questions about how to use office.js or the Office developer platform, please post your question on https://stackoverflow.com. Tag your question with office-js or outlook-web-addins

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions