473,545 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.


Oct 6 '06 #1
8 1592
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
Oct 7 '06 #2
To disable the context menu (right-click or context key), you can use
this:

<body oncontextmenu=" return false;">

See here for more info:
http://javascript.about.com/library/blnoright.htm

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.
Oct 7 '06 #3
pe*******@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:
http://javascript.about.com/library/blnoright.htm

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.
js*******@attgl obal.net
=============== ===
Oct 7 '06 #4
pe*******@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

Oct 7 '06 #5
*** pe*******@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
--
Oct 8 '06 #6
Following on from 's message. . .
>pe*******@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
pe******@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>
Oct 8 '06 #7
Peter Fox wrote:
Following on from 's message. . .
>pe*******@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.
js*******@attgl obal.net
=============== ===
Oct 8 '06 #8
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.
Oct 8 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2692
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff working, but it only worked for IE. You can see a working version here: http://www.publicpen.com/designer/mcControlPanel.php username: designer...
18
1517
by: MuZZy | last post by:
Hi, I got a situation here :) an dwonder if someone can help me. I have an MDI app and say, the child form has a button, clicking on which calls a database transaction - grabbing a lot of tables to the form's TDataSet variable. One transaction grabs about 10 or more Mb of data. If i do several transactions, the memory occupied by the app...
0
916
by: Mike P | last post by:
Hi, I am trying to implement on an ASP.NET page that when a user clicks on a file link, it forces the Save/Open box in the browser. I have managed to do this (with a little help from this newsgroup) but now when the user clicks open, the dialog pops up again and only after clicking open again, the file opens in whatever application is...
6
3053
by: G Dean Blake | last post by:
in my aspx app I am writing a stream that works fine but it replaces what is in the client browser window. The code is as follows: .. .. HttpContext.Current.Response.ClearHeaders() HttpContext.Current.Response.ClearContent() HttpContext.Current.Response.ContentType = "application/pdf" Dim myBuffer(MyStream.Length) As Byte...
9
5411
by: newcomsas | last post by:
Hello. I'm working on a problem related with CSS and javascript: I have got a link on a page and a stylesheet file that makes the background color change when users click on it. Is there anyone who knows if it is possible to 'force' via javascript a status A:active on a link ? I mean: is there a property of the style that can make the...
4
1522
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found the following code to include in the code behind: Response.ContentType = "application/vnd.ms-word" Response.AddHeader("Content-Disposition",...
158
6303
by: Giovanni Bajo | last post by:
Hello, I just read this mail by Brett Cannon: http://mail.python.org/pipermail/python-dev/2006-October/069139.html where the "PSF infrastracture committee", after weeks of evaluation, recommends using a non open source tracker (called JIRA - never heard before of course) for Python itself. Does this smell "Bitkeeper fiasco" to anyone...
4
8551
by: mrouleau | last post by:
I am sorry if this is the wrong group to ask, if so please point me in the correct direction. My problem is I have an MDB file with user-level security on it (mdw). When i move it over to a system that has Access 2007 and try to open it, I get a user name and password prompt. The admin username and password from the other system doesn't...
3
1804
by: Don | last post by:
Is it possible to create a link which will cause either A) the server to serve a fresh copy of a file or B) the browser to "refresh" the copy of the file. Doing it via a link is the only possibility that I think would be viable for our situation, as changing HTTP headers isn't really feasible/desired right now (think 'expires' or...
0
7484
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7440
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.