[HTML] How to make a page not be accessed directly.

2 replies
Hi warrior,

I have 2 web pages for selling a product : A.html and B.html(discounted). The page B will be accessed once the viewers want to close the page A. If they want to access the page B directly, it is impossible.

How can i code this with pure HTML?
#accessed #directly #html #make #page
  • Profile picture of the author 2WDHost
    Hi Baokhau.

    You can try to add the following lines to .htaccess file in folder where A.html and B.html files are located:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://example.com/A.html$
    RewriteRule B.html - [F,NC]
    That should allow access to B.html only for visitors referred from http://example.com/A.html
    But that is not a reliable/secure method. If you need more security then you probably should look into server-side scripting for your task.
    {{ DiscussionBoard.errors[10318532].message }}
  • Profile picture of the author yasar
    Use this script for your html file
    <script type="text/javascript">

    function handleWindowClose()
    if((window.event.clientX <0) || (window.event.clientY <0))
    window.onbeforeunload = handleWindowClose;
    {{ DiscussionBoard.errors[10318786].message }}

Trending Topics