Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mask forwarded blogger urls to own domain urls

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.

like image 915
cplus Avatar asked Jan 30 '16 21:01

cplus


People also ask

Can you hide a URL redirect?

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.

What is masked URL forwarding?

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.

Can you mask website URL?

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.


1 Answers

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)

like image 197
Prayag Verma Avatar answered Oct 15 '22 02:10

Prayag Verma