JavaScript guys, how can I make search engines to access scriptless (no Js) version of a webpage and users use the JavaScript version?

tylero

BANNED - Failed to resolve a dispute
Joined
Sep 26, 2023
Messages
899
Reaction score
332
I have one URL for both users and bots. How can I present different interfaces (js and nojs) to both?
 
Might need more info on this.. you have both both and users.. you want to identify the bots and serve them a static html site is that right? Or do you control the bots?
 
I have one URL for both users and bots. How can I present different interfaces (js and nojs) to both?
You put a reverse proxy in front of whatever is serving your webpage, let it check the IP and user-agent of the client, and if it's a known bot, you serve the nojs page, else you serve the normal js page.

A Cloudlare worker script is a common way of doing things like this.
The worker is in front of your origin server, recieves all the requests and decides what pages to serve.
 
I think you can identify whether it's a bot vs a user with the user-agent header on the HTTP request. Then you can serve the page accordingly. Or even just regex out the JavaScript.
 
Back
Top