If you are looking to connect your external website to Pro3 search, you can do this by adding a stylised search bar from your external site e.g. mydomain.com, and when a user enters a keyword(s), format them through to the following URL structure:
https://{yourPro3domain}/#/search/track/relevance/min-max/min-max/main/k_<keywords>/false/false/
Where <keywords> is what the user entered.
Here is a code sample showing a method in Javascript that will create the URL and redirect the user to it. It triggers off a button click event where the button is called searchButton:
function buildSearchUrl(keywords) {
const cleanedKeywords = keywords
.trim()
.replace(/\s+/g, ' ');
const encodedKeywords = encodeURIComponent(cleanedKeywords);
return `#/search/track/relevance/min-max/min-max/main/k_${encodedKeywords}/false/false/`;
}
document.getElementById('searchButton').addEventListener('click', function () {
const redirectUrl = buildSearchUrl(document.getElementById('searchKeywords').value.trim());
if (!redirectUrl) {
return;
}
window.location.hash = redirectUrl;
});
Comments
Article is closed for comments.