1

I'm looking at a JSS page in connected mode. I log the route to the console and note that there is a property, deviceId, which matches the device called Default.

There are multiple devices in this project. There is the out-of-the-box Print device. I created a device called Googlebot which has the user agent of the Googlebot.

I do not know how to get deviceId to resolve to a device other than Default.

For example, Print is supposedly determined by a query parameter. Append the query parameter, deviceId is still Default. Spoof user agent, deviceId still default, not Googlebot.

What is the algorithm for determining deviceId on JSS pages?

2

Sitecore layout device can be specified via the standard sc_device querystring parameter. In connected mode, headless mode, or api-only mode, you would need to add that parameter to Layout Service requests. In integrated mode, the parameter can be added to Sitecore route requests.

Whether requesting data from Layout Service or browsing in integrated mode, the standard Sitecore device detection and resolution processes are used - JSS doesn't do anything custom.

0

This doesn't answer the question, but might help someone.

Instead of trying to use a Device, we wrote a short Layout Service extender to add a flag to the Sitecore Context. We found the process easier to reason about, and imagine others might as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.