加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

正则表达式 – 掩盖转发的博客网址到自己的域名网址

发布时间:2020-12-13 21:53:59 所属栏目:百科 来源:网络整理
导读:在 how to redirect any blogspot urls with any extension to the mydomain.com corresponding URL上仔细撰写了 Rounin’s answer(非常感谢),现在的问题是如何屏蔽URL? 我的意思是,一旦blogspot URL重定向到mydomain.com,我想继续显示原始的blogspot URL而
在 how to redirect any blogspot urls with any extension to the mydomain.com corresponding URL上仔细撰写了 Rounin’s answer(非常感谢),现在的问题是如何屏蔽URL?
我的意思是,一旦blogspot URL重定向到mydomain.com,我想继续显示原始的blogspot URL而不是mydomain.com.
您可以使用以下JavaScript代码段 –
<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;
}

您可以查看演示here(这是主页)和here(这是来自其他站点的内部URL,原始blogspot URL上不存在)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读