Skip to content

navigator is undefined in SSR and therefore the image cannot be loaded, even if it is a crawler #551

@borjapazr

Description

@borjapazr

How should the behavior be with Angular Universal and the SSR? According to the documentation, the userAgent check is done to detect if it is a crawler, but the in execution on the server side, the navigator object is undefined and therefore cannot get the value of the userAgent. Thus, even if a crawler tries to retrieve the page, the image will not have the src attribute and therefore will not be able to load it.

For example, if I make a request with Postman simulating a crawler, the response is as follows.

image

image

This is because the navigator object is undefined, as can be seen in the following images.

image

image

So, when it is SSR, wouldn't it be better to retrieve the User Agent from the header?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions