Smart Click disable

J

Jeff Wilson

I have a link on a website that provides a document that cannot be
rendered in a browser (by left clicking the link). I'd like to
disable,
for that link only, the left click and pop up a message that instructs
to
right click the link and save to disk. How can I selectively disable a
mouse click like this without it affecting all links in the page?

Thanks in advance.

Jeff
 
B

Barbara de Zoete

I have a link on a website that provides a document that cannot be
rendered in a browser (by left clicking the link). I'd like to
disable,
for that link only, the left click and pop up a message that instructs
to
right click the link and save to disk. How can I selectively disable a
mouse click like this without it affecting all links in the page?

There should be no need for that, I think. Make clear it is a link for a
download and your visitor will know best how s/he has to get the file with
whatever browser s/he is using.
 
N

Neal

I have a link on a website that provides a document that cannot be
rendered in a browser (by left clicking the link). I'd like to
disable,
for that link only, the left click and pop up a message that instructs
to
right click the link and save to disk. How can I selectively disable a
mouse click like this without it affecting all links in the page?

How links are opened is a user agent issue. If the UA cannot handle the
document on a left-click, it should initiate a download anyhow (or an
option to either open or save). So your best bet is to leave it alone, and
indicate to the user the type of file and how it ought to be handled.

<p>You may download <a href="example.exe">the example application</a>. We
recommend right-clicking this link and saving example.exe to your
computer.</p>
 
M

Mitja

I have a link on a website that provides a document that cannot be
rendered in a browser (by left clicking the link). I'd like to
disable,
for that link only, the left click and pop up a message that instructs
to
right click the link and save to disk. How can I selectively disable a
mouse click like this without it affecting all links in the page?

What Barbara said, plus:
if you really want to do it, I guess your best option is to use javascript
like this:
<a href="file.zip" onClick="alert('Please right-click'); return
true">foo</a>

This snippet should be enough to give you the direction in which too look
- I frankly don't expect it to work exactly the way it's written, I've
never used JS :)

If the user has JS disabled, the link will work normally.
 
T

Toby Inkster

Jeff said:
I have a link on a website that provides a document that cannot be
rendered in a browser (by left clicking the link).

What makes you think that my browser can't render it? Just because yours
can't, doesn't mean mine can't.

Just use a regular link. If you were right, and my browser can't display
it, then it will let me either save to disk or open it in a different
application.
 
J

Jeff Wilson

What makes you think that my browser can't render it? Just because yours
can't, doesn't mean mine can't.

Just use a regular link. If you were right, and my browser can't display
it, then it will let me either save to disk or open it in a different
application.

It's for an intranet site. Three file formats are not opening
correctly when
linked from a website. The files are: : ppt, xls, and ms project. And
yes,
I'm aware that the ppt files can be "saved as html", but the files are
automatically downloaded by a script that runs in our configuration
management
tool. Even IE will not render the files in the proper format, so I
want to force the viewer to download the files to their harddrives.

Jeff
 
S

Steve Pugh

It's for an intranet site. Three file formats are not opening
correctly when linked from a website. The files are:
ppt, xls, and ms project.

Even IE will not render the files in the proper format, so I
want to force the viewer to download the files to their harddrives.

If IE can't open the files in Powerpoint, Excel and Word then presumably
the users don't have Powerpoint, Excel and Word installed, so what good
would saving them to disc do?

I suggest that you review the configuration of IE and Office on the
machines. If properly configured IE will open the documents in the
appropriate application, allowing for instant viewing of the files.

Steve
 
J

Jeff Wilson

Mitja said:
What Barbara said, plus:
if you really want to do it, I guess your best option is to use javascript
like this:
<a href="file.zip" onClick="alert('Please right-click'); return
true">foo</a>

This snippet should be enough to give you the direction in which too look
- I frankly don't expect it to work exactly the way it's written, I've
never used JS :)

If the user has JS disabled, the link will work normally.

I actually had already tried this and it does work...sort of. Yes it does
alert the user, but the browser still opens the file with an unreadable ascii
format. I need to prevent the file from opening.

Jeff
 
S

Sybren Stuvel

Jeff Wilson enlightened us with:
the browser still opens the file with an unreadable ascii format.

You never told us this detail (or I missed it). Your server is
probably returning the wrong content type.

Sybren
 
S

Steve Pugh

Jeff Wilson enlightened us with:

You never told us this detail (or I missed it). Your server is
probably returning the wrong content type.

But it's IE.
Are there any values for content-type that (a) IE takes at face value
without sniffing the file and (b) are opened in the browser?

However, I think there may be something in what you say, especially
as:which probably introduces all sorts of ways to screw up the
content-type (and other things)

Steve
 
S

Sybren Stuvel

Steve Pugh enlightened us with:
But it's IE.

That's a pile of horse manure.
Are there any values for content-type that (a) IE takes at face
value without sniffing the file and (b) are opened in the browser?

application/xhtml+xml

Sybren
 
M

Michael Winter

[snip]
<a href="file.zip"
onClick="alert('Please right-click'); return true">foo</a>

You mean, "return false;". You won't cancel the event otherwise.

[snip]

Mike
 
S

Steve Pugh

Steve Pugh enlightened us with:

That's a pile of horse manure.

Yes it is.
application/xhtml+xml

Not opened by the browser. Unless you play silly games with the
registry IE will ask you where you want to save that content-type.

Steve
 
M

Michael Fesser

.oO(Jeff Wilson)
It's for an intranet site. Three file formats are not opening
correctly when
linked from a website. The files are: : ppt, xls, and ms project.

Are they returned with a proper content-type or are they delivered as
text/plain?

Micha
 
J

Jeff Wilson

I'm responding to a couple of posts in this message
If IE can't open the files in Powerpoint, Excel and Word then presumably
the users don't have Powerpoint, Excel and Word installed, so what good
would saving them to disc do?

You presume incorrectly. I have all of them installed and they will
NOT open
on my machine. IE renders them in my browser window but does so as
ascii
text.
I suggest that you review the configuration of IE and Office on the
machines. If properly configured IE will open the documents in the
appropriate application, allowing for instant viewing of the files.

Yeah, well, I can't configure the people's machine's in my office so I
must
come up with another solution. The best I've come up with is the basis
for
my original question. I cannot change the setting on the server
either.
Are they returned with a proper content-type or are they delivered as
text/plain?


Is is ascii format, I believe. Here's a sample:

ÐÏࡱá>þÿ )þÿÿÿþÿÿÿ&'(ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
òÌÉ@á°Áâ\pe57958 B°a=œ¯¼=ñÿñÿÂ.Õ
8X@"·Ú1ÈÿArial1ÈÿArial1ÈÿArial1ÈÿArial1
ÿ¼Tahoma1 ÿTahoma1Èÿ¼Tahoma1ÈÿTahoma1
QTahoma1 Q¼Tahoma1´ÿArial1´ÿTahoma1ŒÿTahoma1ŒTahoma1
Tahoma1´¼Tahoma1ȼArial1ð¼Arial1
Q¼Tahoma1 QTahoma1,xÿ¼Monotype
Sorts1xQTahoma1´ÿ¼Tahoma1 QTahoma1
ÿWebdings1&Èÿ Courier
New"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)
 
J

Jeff Wilson

Steve Pugh said:
I suggest that you review the configuration of IE and Office on the
machines. If properly configured IE will open the documents in the
appropriate application, allowing for instant viewing of the files.

What settings need to be made? I couldn't find any that made a difference...

Jeff
 
T

Toby Inkster

Jeff said:
Is is ascii format, I believe.

You need to configure your web server to return these files with the
correct MIME type. Consult the documentation that came with your web
server, or Google, if you're unsure how to do this.
 
B

Barbara de Zoete

What settings need to be made? I couldn't find any that made a
difference...

perhaps this is not a alt.html question and you can get more to the point
help in one of the microsoft.public newsgroups. I tried to find an
appropriate one, but there are many and I didn't take long to look. But
I'm sure there is one. Something that starts with microsoft.public. You
could start at
<http://groups.google.com/groups?hl=nl&lr=&group=microsoft.public.internetexplorer>
or
<http://groups.google.com/groups?hl=nl&lr=&group=microsoft.public.inetexplorer>
 
M

Michael Fesser

.oO(Jeff Wilson)
You presume incorrectly. I have all of them installed and they will
NOT open
on my machine. IE renders them in my browser window but does so as
ascii text.

This means the server sends them with the default content type
text/plain.
Are they returned with a proper content-type or are they delivered as
text/plain?

Is is ascii format, I believe. Here's a sample: [...]

Configure the server to send the correct content types:

application/vnd.ms-powerpoint
application/vnd.ms-excel
application/vnd.ms-project

Application Media-Types
http://www.iana.org/assignments/media-types/application/

Micha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top