简体   繁体   English

使链接只能从相同域的特定网页访问

[英]making a link accessible only from specific webpage same domain

Is there a simple way to make a webpage only accessible from a specified link? 有没有一种简单的方法可以使网页只能从指定的链接访问?

I have a webpage with prettyphoto popups. 我有一个带有prettyphoto弹出窗口的网页。 The popup is calling an html page with a jwplayer script. 弹出窗口正在调用带有jwplayer脚本的html页面。 I'd like to avoid anyone going directly to that page being called into prettyphoto. 我想避免任何直接进入该页面的人被调用为prettyphoto。

EDIT : (code from comments) 编辑 :(来自注释的代码)

<ul class="gallery clearfix">
    <p class="p-bigger">more about sftc</p>
    <li><a href="vids/sc1.html?iframe=true&width=650&height=650" rel="prettyPhoto[iframes]" title="more about sftc"><img src="images/scene-images/sc1.jpg" width="180" height="135" /></a> 
    </li>
</ul>

I want to be able to have this link only be available from this page, and not for someone to copy this link, paste it in a browser and go directly to that page being called 我希望只能在此页面上使用此链接,而不希望某人复制此链接,然后将其粘贴到浏览器中,然后直接转到该页面。

As it was mentioned, the link can be spoofed but since that page should be opened inside an iframe (prettyphoto iframe mode) then at least you can check if it was opened inside an iframe. 如前所述,链接可以被欺骗,但是由于该页面应该在iframe中打开(prettyphoto iframe模式),因此至少您可以检查它是否在iframe中打开。

You can add this to the sc1.html page : 您可以将其添加到sc1.html页面:

var is_iframe = self != top;

if( !is_iframe ){
    // page is not inside an iframe so redirect 
    window.location.href = "http://www.mypage.com/";
}

To make a long story short: Nope not really possible. 简而言之:不行,这是不可能的。 You could check the referring link, but that can easily be spoofed. 您可以检查引荐链接,但这很容易被欺骗。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM