首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >相同的URL提供不同的内容-为什么?

相同的URL提供不同的内容-为什么?
EN

Stack Overflow用户
提问于 2014-04-07 20:15:53
回答 1查看 1.4K关注 0票数 1

如果您已登录,此URL:https://download.ama-assn.org/resources/doc/usan/x-pub/usan-february-2014-newsletter.pdf返回html页面:

代码语言:javascript
复制
<div id="dlblock">
    <a href="http://www.ama-assn.org">
        <img src="https://www.ama-assn.org/resources/images/header/ama-logo.png" border="0">
    </a><br><br>
    You are about to download<br>
    <strong>
         <a id="file-link" href="/resources/doc/usan/x-pub/usan-february-2014-newsletter.pdf" target="_blank">usan-february-2014-newsletter.pdf</a>
    </strong>
    If you are not automatically redirected, please 
    <a href="/resources/doc/usan/x-pub/usan-february-2014-newsletter.pdf" target="_blank">click here</a> 
    to begin your download.   <br><br>
    <small>Copyright 1995-2014 
        <a href="http://www.ama-assn.org">American Medical Association</a> All rights reserved.
    </small>

如果您单击此页面上的链接( url是刚刚在新窗口中打开的同一页),您将得到pdf。

我不明白服务器如何决定什么时候提供html和pdf --这是如何实现的?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-07 20:20:32

服务器可以读取http referer请求头,如果它与页面的URL匹配,则提供PDF版本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22922195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档