It is absolutely achievable and straightforward!
To bypass Instagram's in-app browser, take advantage of its weakness in file downloading. When you prompt it to download a file, it triggers an external browser, giving you the opportunity to redirect the user.
Begin by identifying the user's browser when they visit your site.
In simpler terms:
<script>
if(navigator.userAgent.includes("Instagram")){
window.location.href = "https://mywebsite.com/DummyBytes";
}
</script>
Next, set up the DummyBytes API. This API provides different responses based on the viewer's browser. For Instagram's in-app browser, it will return dummy bytes as a file, while other browsers will be redirected to your main site (mywebsite.com).
<?php
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($userAgent, 'Instagram')) {
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename= blablabla');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
@readfile($file);
}
else{
header('Location: https://halterapp.com');
}
?>
For further instructions, refer to the following link:
Opening of your website in the viewer’s external browser automatically instead of Instagram’s in-app browser