How do you show a user somthing different if theyre in replit?

i made a game that doesn’t work on the Replit page, it requires you to go to its website to play, is there a way do detect whether or not the user is running my repl on the replit page or using the website and show different content if they are on replit page, I am getting toooo many comments about it not working and people aren’t checking the description witch tells them to open in a new tab

If you’re serving HTML content, you could use a JavaScript script to check either the size of the window (if that’s what really matters) or whether the window is within an iframe.

If size matters:

window.addEventListener("load", function() {
	if (window.innerWidth <= some size || window.innerHeight <= some size) {
		// you probably don't want to use alert, this is just to demonstrate
		alert("Please open in a larger window.");
	}
});

If iframe matters:

if (window !== window.top) {
	// you probably don't want to use alert, this is just to demonstrate
	alert("Please open this Repl in its own window.");
}
2 Likes