Smart Click disable

Discussion in 'HTML' started by Jeff Wilson, Nov 18, 2004.

  1. Jeff Wilson

    Jeff Wilson Guest

    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
     
    Jeff Wilson, Nov 18, 2004
    #1
    1. Advertising

  2. On 18 Nov 2004 09:25:00 -0800, Jeff Wilson <> wrote:

    > 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.


    --
    Webontwerp <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html>
    Zweefvliegen <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
    Blog <http://home.wanadoo.nl/b.de.zoete/_private/weblog.html>
    DTD <http://home.wanadoo.nl/b.de.zoete/dtd/not_so_strict.dtd>
     
    Barbara de Zoete, Nov 18, 2004
    #2
    1. Advertising

  3. Jeff Wilson

    Neal Guest

    On 18 Nov 2004 09:25:00 -0800, Jeff Wilson <> wrote:

    > 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>
     
    Neal, Nov 18, 2004
    #3
  4. Jeff Wilson

    Mitja Guest

    On 18 Nov 2004 09:25:00 -0800, Jeff Wilson <> wrote:

    > 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.

    --
    Mitja
     
    Mitja, Nov 18, 2004
    #4
  5. Jeff Wilson

    Toby Inkster Guest

    Jeff Wilson wrote:

    > 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Nov 18, 2004
    #5
  6. Jeff Wilson

    Jeff Wilson Guest

    > 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
     
    Jeff Wilson, Nov 19, 2004
    #6
  7. Jeff Wilson

    Steve Pugh Guest

    On 19 Nov 2004 07:03:16 -0800, Jeff Wilson <> wrote:

    >> 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.
    >
    > 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


    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
     
    Steve Pugh, Nov 19, 2004
    #7
  8. Jeff Wilson

    Jeff Wilson Guest

    Mitja <> wrote in message news:<opshoed5cvdob4us@localhost>...
    > 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
     
    Jeff Wilson, Nov 19, 2004
    #8
  9. 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
    --
    The problem with the world is stupidity. Not saying there should be a
    capital punishment for stupidity, but why don't we just take the
    safety labels off of everything and let the problem solve itself?
     
    Sybren Stuvel, Nov 19, 2004
    #9
  10. Jeff Wilson

    Steve Pugh Guest

    On Fri, 19 Nov 2004 18:49:38 +0100, Sybren Stuvel
    <> wrote:

    >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.


    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:
    >> the files are automatically downloaded by a script that runs in our
    >> configuration management tool

    which probably introduces all sorts of ways to screw up the
    content-type (and other things)

    Steve
     
    Steve Pugh, Nov 19, 2004
    #10
  11. 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
    --
    The problem with the world is stupidity. Not saying there should be a
    capital punishment for stupidity, but why don't we just take the
    safety labels off of everything and let the problem solve itself?
     
    Sybren Stuvel, Nov 19, 2004
    #11
  12. On Thu, 18 Nov 2004 20:43:07 +0100, Mitja <> wrote:

    [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

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Nov 19, 2004
    #12
  13. Jeff Wilson

    Steve Pugh Guest

    On Fri, 19 Nov 2004 20:14:32 +0100, Sybren Stuvel
    <> wrote:

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

    >
    >That's a pile of horse manure.


    Yes it is.

    >> 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


    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
     
    Steve Pugh, Nov 19, 2004
    #13
  14. .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
     
    Michael Fesser, Nov 21, 2004
    #14
  15. Jeff Wilson

    Jeff Wilson Guest

    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\)
     
    Jeff Wilson, Nov 22, 2004
    #15
  16. Jeff Wilson

    Jeff Wilson Guest

    "Steve Pugh" <> wrote in message news:<opshpwdkn606el5p@stevepughlaptop>...
    > 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
     
    Jeff Wilson, Nov 22, 2004
    #16
  17. Jeff Wilson

    Toby Inkster Guest

    Jeff Wilson wrote:
    > Someone wrote:
    >
    >> Are they returned with a proper content-type or are they delivered as
    >> text/plain?

    >
    > 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./van_morrison/caravan.ogg
     
    Toby Inkster, Nov 22, 2004
    #17
  18. On 22 Nov 2004 10:17:07 -0800, Jeff Wilson <> wrote:

    > "Steve Pugh" <> wrote in message
    > news:<opshpwdkn606el5p@stevepughlaptop>...
    >> 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...
    >


    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>


    --
    Weblog | <http://home.wanadoo.nl/b.de.zoete/_private/weblog.html>
    Webontwerp | <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html>
    Zweefvliegen | <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
     
    Barbara de Zoete, Nov 22, 2004
    #18
  19. .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
     
    Michael Fesser, Nov 22, 2004
    #19
  20. Jeff Wilson

    Mitja Guest

    On Fri, 19 Nov 2004 21:13:34 GMT, Michael Winter
    <> wrote:

    > On Thu, 18 Nov 2004 20:43:07 +0100, Mitja <> wrote:
    >
    > [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]


    Whooops, thanks. I knew a boolean had to be returned :)


    --
    Mitja
     
    Mitja, Nov 23, 2004
    #20
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MotoK
    Replies:
    59
    Views:
    1,867
    Keith Thompson
    Sep 15, 2006
  2. Farooq
    Replies:
    0
    Views:
    320
    Farooq
    Feb 1, 2008
  3. Farooq
    Replies:
    0
    Views:
    248
    Farooq
    Feb 1, 2008
  4. Farooq
    Replies:
    0
    Views:
    347
    Farooq
    Feb 4, 2008
  5. Farooq
    Replies:
    0
    Views:
    280
    Farooq
    Feb 4, 2008
Loading...

Share This Page