Hostinger builder just allow us to add a html code in a iframe section.
so, I added my code and I need to get window location search.
<script>
async function getpostID(){
const urlParams = new URLSearchParams(window.location.search);
console.log(urlParams);
const postId = urlParams.get('id');
console.log(postId);
return postId;
}
// Example function to fetch blog post by ID
async function fetchBlogPostById(postId) {
}
document.addEventListener('DOMContentLoaded', () => fetchBlogPostById( getpostID() ));
</script>
I tried to set the function getpostID() in the integration section of Hostinger
but the internal code of the Iframe can’t see it