Forcing the user to open a link in a special way.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Axel Gallus

    Forcing the user to open a link in a special way.

    I want to realize the following....

    The user logs in to a certain webpage (username & password).
    Then the user sees a html page with a link in it.
    This link is a target="_blank" link, so it would open in a new Internet
    Explorer window.
    Normally the user has the possibility to go on that link (without clicking
    with left mousebutton),
    pressing the right mouse button, going on copy location, open a new
    browserwindow by
    himself (even if it is a totally other browsertype),
    copy the link location in it, and access the url of the link in this manner.

    I want to prevent this. He should only be able to open the link by pressing
    the left mousebutton,
    otherwise he should have to log in again.

    Is this possible, if yes - how?


    A.G.




  • Pedro Graca

    #2
    Re: Forcing the user to open a link in a special way.

    Axel Gallus wrote:
    The user logs in to a certain webpage (username & password).
    Then the user sees a html page with a link in it.
    This link is a target="_blank" link, so it would open in a new Internet
    Explorer window.
    [...]
    He should only be able to open the link by pressing
    the left mousebutton, otherwise he should have to log in again.
    >
    Is this possible, if yes - how?
    It is impossible with PHP.

    --
    File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

    Comment

    • petersprc@gmail.com

      #3
      Re: Forcing the user to open a link in a special way.

      To disable the context menu (right-click or context key), you can use
      this:

      <body oncontextmenu=" return false;">

      See here for more info:


      In addition, you can check the referrer URL which will block some
      attempts to access the page by just pasting the URL in the browser.
      (This can be circumvented by the user however because the referrer can
      be spoofed.) Here's an example:

      function checkReferrer($ uriPath)
      {
      $from = '#^https?://' . preg_quote($_SE RVER['HTTP_HOST']) .
      '((?-i)' . preg_quote($uri Path) . ')$#i';
      if (!isset($_SERVE R['HTTP_REFERER']) ||
      !preg_match($fr om, $_SERVER['HTTP_REFERER'])) {
      die();
      }
      }

      //
      // Pass the path to your referrer script here:
      //

      checkReferrer('/path/to/script.php');

      Best Regards,

      John Peters

      Axel Gallus wrote:
      I want to realize the following....
      >
      The user logs in to a certain webpage (username & password).
      Then the user sees a html page with a link in it.
      This link is a target="_blank" link, so it would open in a new Internet
      Explorer window.
      Normally the user has the possibility to go on that link (without clicking
      with left mousebutton),
      pressing the right mouse button, going on copy location, open a new
      browserwindow by
      himself (even if it is a totally other browsertype),
      copy the link location in it, and access the url of the link in this manner.
      >
      I want to prevent this. He should only be able to open the link by pressing
      the left mousebutton,
      otherwise he should have to log in again.
      >
      Is this possible, if yes - how?
      >
      >
      A.G.

      Comment

      • Jerry Stuckle

        #4
        Re: Forcing the user to open a link in a special way.

        petersprc@gmail .com wrote:
        To disable the context menu (right-click or context key), you can use
        this:
        >
        <body oncontextmenu=" return false;">
        >
        See here for more info:

        >
        In addition, you can check the referrer URL which will block some
        attempts to access the page by just pasting the URL in the browser.
        (This can be circumvented by the user however because the referrer can
        be spoofed.) Here's an example:
        >
        function checkReferrer($ uriPath)
        {
        $from = '#^https?://' . preg_quote($_SE RVER['HTTP_HOST']) .
        '((?-i)' . preg_quote($uri Path) . ')$#i';
        if (!isset($_SERVE R['HTTP_REFERER']) ||
        !preg_match($fr om, $_SERVER['HTTP_REFERER'])) {
        die();
        }
        }
        >
        //
        // Pass the path to your referrer script here:
        //
        >
        checkReferrer('/path/to/script.php');
        >
        Best Regards,
        >
        John Peters
        >
        Axel Gallus wrote:
        >
        >>I want to realize the following....
        >>
        >>The user logs in to a certain webpage (username & password).
        >>Then the user sees a html page with a link in it.
        >>This link is a target="_blank" link, so it would open in a new Internet
        >>Explorer window.
        >>Normally the user has the possibility to go on that link (without clicking
        >>with left mousebutton),
        >>pressing the right mouse button, going on copy location, open a new
        >>browserwind ow by
        >>himself (even if it is a totally other browsertype),
        >>copy the link location in it, and access the url of the link in this manner.
        >>
        >>I want to prevent this. He should only be able to open the link by pressing
        >>the left mousebutton,
        >>otherwise he should have to log in again.
        >>
        >>Is this possible, if yes - how?
        >>
        >>
        >>A.G.
        >
        >
        Which fails miserably if the user has disabled javascript.

        There is no foolproof way to do it.
        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • usenet+2004@john.dunlop.name

          #5
          Re: Forcing the user to open a link in a special way.

          petersprc@gmail .com:
          To disable the context menu (right-click or context key), you can use
          this:
          >
          <body oncontextmenu=" return false;">
          How rude!

          (You would need to modify your DTD as well, since no version of HTML
          allows the attribute oncontextmenu.)

          --
          Jock

          Comment

          • Alvaro G. Vicario

            #6
            Re: Forcing the user to open a link in a special way.

            *** petersprc@gmail .com escribió/wrote (6 Oct 2006 18:22:52 -0700):
            In addition, you can check the referrer URL which will block some
            attempts to access the page by just pasting the URL in the browser.
            (This can be circumvented by the user however because the referrer can
            be spoofed.)
            Last but not least, you must check $_SERVER['USER_AGENT'] to filter out
            whoever is not using Internet Explorer as desired. It is not bulletproof
            but, at this point, any Firefox or Opera user will have probably left the
            site.


            --
            -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
            ++ Mi sitio sobre programación web: http://bits.demogracia.com
            +- Mi web de humor con rayos UVA: http://www.demogracia.com
            --

            Comment

            • Peter Fox

              #7
              Re: Forcing the user to open a link in a special way.

              Following on from 's message. . .
              >petersprc@gmai l.com:
              >
              >To disable the context menu (right-click or context key), you can use
              >this:
              >>
              > <body oncontextmenu=" return false;">
              >
              >How rude!
              Agreed.
              >
              >(You would need to modify your DTD as well, since no version of HTML
              >allows the attribute oncontextmenu.)
              >
              I thought this was a load of bull but strangely when I tried it in
              Firefox (with js enabled) it worked.




              --
              PETER FOX Not the same since the statuette business went bust
              peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
              2 Tees Close, Witham, Essex.
              Gravity beer in Essex <http://www.eminent.dem on.co.uk>

              Comment

              • Jerry Stuckle

                #8
                Re: Forcing the user to open a link in a special way.

                Peter Fox wrote:
                Following on from 's message. . .
                >
                >petersprc@gmail .com:
                >>
                >>To disable the context menu (right-click or context key), you can use
                >>this:
                >>>
                >> <body oncontextmenu=" return false;">
                >>
                >>
                >How rude!
                >
                Agreed.
                >
                >>
                >(You would need to modify your DTD as well, since no version of HTML
                >allows the attribute oncontextmenu.)
                >>
                I thought this was a load of bull but strangely when I tried it in
                Firefox (with js enabled) it worked.
                >
                >
                >
                >
                Disable js...

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • ZabMilenko

                  #9
                  Re: Forcing the user to open a link in a special way.

                  Jerry is right. You can use those deprecated or unsupported stuff in most
                  browsers because they are quite forgiving.

                  But, just disable javascript and *poof* your whole scheme is gone. Also,
                  thanks to extensions like GreaseMonkey, someone could just disable
                  javascript for your site or even just for a single page on your server.

                  I also have a one-click on/off switch for javascript right in my toolbar on
                  FireFox. Took 15 seconds to install.


                  Perhaps better would be the reason you want to prevent this.. If you are
                  trying to stop people from saving your web content, then your only option is
                  not to generate web content. For what reason do you want to block this action?



                  Peter Fox wrote:
                  >
                  I thought this was a load of bull but strangely when I tried it in
                  Firefox (with js enabled) it worked.
                  >

                  Comment

                  Working...