How to solve the white page problem in blazor server.

wilfried kinda 0 Reputation points
2024-04-22T12:36:24.15+00:00

When I start my blazor server application, the page content is displayed for less than a second, then I get a blank page.

When I right-click inpect in the browser I get the code :

<html>

  **<head></head>**

  **<body>2024</body>**
```**</html>**

Neither the css style nor the js are loaded.
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,635 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 68,716 Reputation points
    2024-04-29T17:47:06.5333333+00:00

    we can not see your code, but you appear to have a Blazor component wrap a google map. this takes extreme care. both libraries directly update the dom, and can overwrite each others content (this is why jQuery is usually a bad idea with Blazor apps).

    have the Blazor component renders a <div id="map"> that the map applies to. also do not use the browser load event, but rather the Blazor component OnAfterRender event to create the map:

    var map = new google.maps.Map(document.getElementById("map"), mapOptions);

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.