The setUnauthenticatedUserSearchPreferences
method is available in custom.js
scripts after the application is fully loaded. It allows administrators to set search preferences for unauthenticated users with the same syntax as the one used to configure a realm.
See Configure search preferences for more information.
Example
const preferences = {
metadata: {
Category: {
filter: ["Screencasts", "How To"]
},
Version: {
prior: "latest"
}
}
}
setUnauthenticatedUserSearchPreferences(preferences)
- Only the metadata field is used and verified.
- Advanced users can add arbitrary fields to the preferences object to identify the payload.
Example with arbitrary fields added
const preferences = {
persona: "Tech writer", // This field is ignored but saved
metadata: {
Category: {
filter: ["Screencasts", "How To"]
}
}
}