Open aidanhorton opened 3 years ago
Hi,
It is possible, Ecosia can do it...
perhaps you can try adding Google search suggestions? Also, it wouldn't be the worst case as Google's search suggestions are far more advanced
Even if Ecosia can do it, it doesn't mean that I can steal their mechanism (from a technical standpoint). Most of their code is server-side and it'd require me virtually wiring into their system, and they likely have certain safeguards in place. Unfortunately it's not as easy as just being able to do it like they do - this is why APIs are useful, and why I may have to switch to using a Google search suggestion dropdown instead, as they likely have APIs to do this.
Okay, no problem. I'll look into potential solutions for this one as well. Thanks for always being so helpful 😊
Here are the headers being sent to Ecosia in order to get the suggestions:
This is the response:
I managed to get the suggestions through JavaScript, but I'll wait until you finish the new-tab-page to do more with this. I don't think there are any legal-issues regarding this, but tell if there is anything.
Here is something:
fetch('https://ac.ecosia.org/?q=hei&mkt=en-gb')
.then(response => response.json())
.then(data => console.log(data))
Oh wow what a good spot! That's great stuff, I'll finish up the new tab page as soon as I can and then we can whack this in - great detective work! :)
Attempted this a while back - thought it was impossible due to Ecosia not releasing an API.
It is possible though as I've seen a similar thing in other new-tab pages - worst case scenario I could implement Google search suggestions, but take you to the Ecosia search results for that term.
For reference, when you're searching in the Ecosia search bar, it gives suggestions on what to search ('Tes' might suggest 'Test' or 'Tesco')