Following Rounin's answer carefully written (thanks a lot) on how to redirect any blogspot urls with any extension to the mydomain.com corresponding URL, now the question is how can I mask the URL? I mean, once the blogspot URL redirects to the mydomain.com, I want to continue to display the original blogspot URL instead of the mydomain.com.
A masked redirect empowers you to use content from another domain while keeping your original domain name in the address bar. You use the URL of your homepage (your domain name) as the URL for every page of your website. A masked redirect is also called URL cloaking or domain masking.
URL masking, also known as cloaked URL forwarding, or link cloaking, uses your domain name for your website in a different way. In this case, the domain points to a browser with a frame which shows your website within it. No matter which page you click on your website, the URL in your address bar stays the same.
There are many ways to mask a URL. One of these ways is to embed an HTML frame in the main website, redirecting a user to a completely different site. Others include virtual hosting or rewriting a URL. Doing this masks the original URL displaying the masked version instead.
You can use the following JavaScript snippet for that -
<script>
site = "http://example.com"; // The site which you want to mask, don't add ending slash
iFrame = document.createElement("iframe"); // Creates a iframe via JavaScript
iFrame.setAttribute("src", site + location.pathname); // Set the source of iFrame
iFrame.setAttribute("class", "maskingFrame"); // Add class to iFrame
document.body.appendChild(iFrame); // Append iframe to body of page
</script>
And the bare minimal CSS would be -
body {
overflow:hidden;
}
.maskingFrame, body {
width:100%;
height:100%;
border: none;
}
You can check a demo here (This is the homepage) and here (This is an internal URL from other site which doesn't exist on the original blogspot URL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With