You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
This is because the navigator object is undefined, as can be seen in the following images.
So, when it is SSR, wouldn't it be better to retrieve the User Agent from the header?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
To be honest, the SSR support is not well thought out and I have never used Angular with SSR so I'm happy to take change suggestions.
The idea right now is that modern search engine bots support javascript so the application will load the images on the client side, not the backend side. Eg.
It is confusing and maybe wrong that isBot always returns false on the server. That should be fixed, at least so the code is clearer.
So, when it is SSR, wouldn't it be better to retrieve the User Agent from the header?
Absolutely! But is that possible? I tried to google this but could not find a nice solution for this, but as I said earlier I have no experience with SSR and Angular.
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.
This is because the navigator object is undefined, as can be seen in the following images.
So, when it is SSR, wouldn't it be better to retrieve the User Agent from the header?
Thanks in advance!
The text was updated successfully, but these errors were encountered: