将转发的博客网址屏蔽为自己的域网址 [英] Mask forwarded blogger urls to own domain urls

查看:77
本文介绍了将转发的博客网址屏蔽为自己的域网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Roinin的答案上认真撰写(谢谢很多)上的内容如何将任何具有任何扩展名的Blogspot URL重定向到mydomain.com对应的网址,现在的问题是如何屏蔽该网址?
我的意思是,一旦Blogspot URL重定向到mydomain.com,我想继续显示原始的blogspot URL,而不是mydomain.com。

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.

推荐答案

您可以使用以下JavaScript代码段-

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> 

最简单的CSS就是-

body {
    overflow:hidden;
}
.maskingFrame, body {
    width:100%;
    height:100%;
    border: none;
}

您可以查看演示此处(这是主页)和此处(这是其他站点的内部URL,原始博客站点URL上不存在)

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)

这篇关于将转发的博客网址屏蔽为自己的域网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆