Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:40:34+00:00 2026-05-22T00:40:34+00:00

So I am embedding a PDF file on my page: <embed src=http://www.mywebsite.com/files/ebook.pdf width=500 height=375>

  • 0

So I am embedding a PDF file on my page:

<embed src="http://www.mywebsite.com/files/ebook.pdf" width="500" height="375">

Is there anyway to prevent any and all access to that file except for when it is being accessed via this embed?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:40:35+00:00Added an answer on May 22, 2026 at 12:40 am

    More elegant way would be to prevent access to that file or better directory from .htaccess file and only allow locally. Then your php script will acss the file when you need it. You can also force download from php.

    See this for php example.
    And your .htaccess file will look like this and will reside in your restricted directory (where pdf is located):

    #denies access to all but the allowed IP (presumably yours)
    #all other users will be redirected to the ErrorDocument
    ErrorDocument 403 http://www.example.com/your-login-page.php
    Order deny,allow
    Deny from all
    Allow from 76.117.227.192
    

    Last line is your IP address (server) or put simply Allow from localhost instead. If somebody else will try to access the directory or files in it, they will be redirected to ttp://www.example.com/your-login-page.php with status code 403 (access forbidden). Good Luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experimenting with embedding my pure offline mobile HTML5 ebook reader (http://www.hyper-books.com/) into
I am embedding my videos with JW player http://www.longtailvideo.com/players/ and I have a problem
Hi I am embedding pdf file to my asp.net page like this <object data=...
Im embedding a youtube video in JWPlayer like this: <embed src=fileadmin/templates/web/js/jwplayer/player.swf width=300 height=225 bgcolor=transparent
I'm trying to embed a PDF file into a Word document using the OLE
Generally, browsers show the image and pdf files without embedding them in html. I
I am embedding a pdf document on a HTML5 page using a code similar
I'm embedding a PDF in a web page with the following html <object id=pdf
i am embedding a javascript file inside an svg file like this: <svg xmlns:dc=http://purl.org/dc/elements/1.1/
I just landed a big contract that includes embedding PDF pages on html pages.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.