Adding styles based on in_app query parameter on URL
Learn how to remove elements of an external website using our in_app query parameter
- Check for query parameter and apply relevant CSS needed e.g css to hide the header and footer
- Our standard query parameter is
in_appand more. For more detail, see: Sending parameters in a query string to external domains - Note you are responsible for persisting any values (via a cookie) if the user navigates onwards
Example
<html>
<head>
</head>
<body>
<div class="header">Header</div>
<div class="footer">Footer</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('in_app');
if(myParam !== null){
var styles = `
.header,
.footer {
display: none;
}`
}
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
</script>
</body>

