onload=window.open problem

Discussion in 'HTML' started by hol, Feb 14, 2006.

  1. hol

    hol Guest

    I have this problem
    I want to automatically download a word document as long as a page has been
    loaded.
    I used the following code

    <body onload=window.open('http://www.mydomain.com/document.doc');return
    true;>

    but it doesn't seem to work.

    Is there a way to open the word document, or even better activate the Save
    As dialog?

    Thanks beforehand

    Mark
    hol, Feb 14, 2006
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed "hol" <> writing in
    news:dst9ut$3r7$:

    > I have this problem
    > I want to automatically download a word document as long as a page has
    > been loaded.
    > I used the following code
    >
    ><body onload=window.open('http://www.mydomain.com/document.doc');return
    > true;>
    >
    > but it doesn't seem to work.
    >
    > Is there a way to open the word document, or even better activate the
    > Save As dialog?
    >
    > Thanks beforehand
    >
    > Mark
    >
    >
    >


    I would be very unhappy if I went to a web site and it tried to open a Word
    document, or tried to download something to me without my permission.

    You also have to realise that not everyone _has_ Word.

    Better:
    <a href="document.doc" type="application/ms-word" title="Word Document XXX
    kb">Document (xxx kb) MS Word</a>

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne Boswell, Feb 15, 2006
    #2
    1. Advertising

  3. hol wrote:
    > Is there a way to open the word document, or even better activate the Save
    > As dialog?


    Make it a link? The user decides how (if) a Word document can be
    opened. For example in "MY" IE, it just opens. In my wifes it has the
    dialog box.
    Travis Newbury, Feb 15, 2006
    #3
  4. hol

    RvT_PE Guest

    Hi Travis,

    What Adrienne is trying to say is that many people would find it
    suspicious when entering a website with an onload Word document.

    Anyway, if a document type is not being recognised, then it will open a
    dialog box, but if you subsequently give it permission to always open
    it with Word, then the next time such dialog box will not appear. The
    latter you have probably done and your wife not, hence the difference.
    RvT_PE, Feb 15, 2006
    #4
  5. RvT_PE wrote:
    > What Adrienne is trying to say is that many people would find it
    > suspicious when entering a website with an onload Word document.
    > Anyway, if a document type is not being recognised, then it will open a
    > dialog box, but if you subsequently give it permission to always open
    > it with Word, then the next time such dialog box will not appear. The
    > latter you have probably done and your wife not, hence the difference.


    I know the difference, I was pointing out we chose differently.
    Travis Newbury, Feb 15, 2006
    #5
  6. hol

    RvT_PE Guest

    Okay, sorry, did not catch that one.

    Have you tried:

    <body
    onload="window.open('http://www.mydomain.com/document.doc');return"
    true;="true;">

    Or is there a pop-up blocker somewhere active?
    RvT_PE, Feb 15, 2006
    #6
  7. hol

    RvT_PE Guest

    Something went wrong with the copy and paste.

    <body
    onload="window.open('http://www.mydomain.com/document.doc');return
    true;">

    Works for me in FireFox and IE.
    RvT_PE, Feb 15, 2006
    #7
  8. hol

    hol Guest

    Thanks for all your responce.

    I did try RvT_PE's suggestion and it was actually my very first try. For
    some reason, it didn't work. It works with JPGs, Gifs etc but not word
    documents.

    Now as far as Adrienne't reply, I understand what you are saying, but there
    is nothing suspicious behind this method. The site is being built in Flash
    and when the user clicks a certain button it loads the HTML file that opens
    the word document. So the user decides whether or not to open it.

    Thank you all

    Mark

    ? "RvT_PE" <> ?????? ??? ??????
    news:...
    > Something went wrong with the copy and paste.
    >
    > <body
    > onload="window.open('http://www.mydomain.com/document.doc');return
    > true;">
    >
    > Works for me in FireFox and IE.
    >
    hol, Feb 16, 2006
    #8
  9. hol wrote:
    > Thanks for all your responce.
    >
    > I did try RvT_PE's suggestion and it was actually my very first try. For
    > some reason, it didn't work. It works with JPGs, Gifs etc but not word
    > documents.
    >
    > Now as far as Adrienne't reply, I understand what you are saying, but there
    > is nothing suspicious behind this method. The site is being built in Flash
    > and when the user clicks a certain button it loads the HTML file that opens
    > the word document. So the user decides whether or not to open it.
    >


    Whether or not the user's browser will 'open' a Word document or gives a
    'Save as' dialog depends on, the user's OS, the user's browser, the
    user's has the application 'Word' and what the user's default handling
    settings are for Word documents. The key work here is 'user' not your
    coding, in fact using your JavaScript method of creating a popup window
    linked to the original document's onload event in a misguided attempt to
    'force' the document on your visitor's will not work with my Firefox
    that will block the popup!

    This is just a bad idea on many levels!

    1. Word documents like many high-level document formats can have
    embedded scripting code that has been frequently use as worm delivery
    tools, so there is a security issue involved here and this type of file
    should never be 'automatically' loaded!

    2. Yes Billy does own most of the world but not ALL of it yet, Word is a
    proprietary document, so again should never be 'automatically' loaded!

    3. Word documents because of their formatting, scripting and proprietary
    format a generally larger (most time many-fold) then plain text or html
    counter parts and are not optimal for general web delivery especially if
    'automatically' loaded! Not everyone has broadband.

    4. Lastly it is just bad etiquette akin to a tele-marketer's call at
    diner-time. Be polite use a regular link with the file description and
    file size noted

    <a href="pricelist.doc">Our Price List in MS Word200 format (1.2 MB)</a>
    or in <a href="pricelist.txt">Our Price List in plain text (10 KB) </a>


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Feb 16, 2006
    #9
  10. hol

    hol Guest

    Hi Jonathan, thanks for the comments,

    The problem is that my customer wants the site visitors to be able to
    download his CV as a word file. This doesn't happen automatically but only
    when a user clicks the appropriate button on the main Flash site. This
    button opens an html page that loads the word document. As you can see I
    have to go through this procedure.

    Take care,

    Mark


    ? "Jonathan N. Little" <> ?????? ??? ??????
    news:43f4b739$0$25092$...
    > hol wrote:
    >> Thanks for all your responce.
    >>
    >> I did try RvT_PE's suggestion and it was actually my very first try. For
    >> some reason, it didn't work. It works with JPGs, Gifs etc but not word
    >> documents.
    >>
    >> Now as far as Adrienne't reply, I understand what you are saying, but
    >> there is nothing suspicious behind this method. The site is being built
    >> in Flash and when the user clicks a certain button it loads the HTML file
    >> that opens the word document. So the user decides whether or not to open
    >> it.
    >>

    >
    > Whether or not the user's browser will 'open' a Word document or gives a
    > 'Save as' dialog depends on, the user's OS, the user's browser, the user's
    > has the application 'Word' and what the user's default handling settings
    > are for Word documents. The key work here is 'user' not your coding, in
    > fact using your JavaScript method of creating a popup window linked to the
    > original document's onload event in a misguided attempt to 'force' the
    > document on your visitor's will not work with my Firefox that will block
    > the popup!
    >
    > This is just a bad idea on many levels!
    >
    > 1. Word documents like many high-level document formats can have embedded
    > scripting code that has been frequently use as worm delivery tools, so
    > there is a security issue involved here and this type of file should never
    > be 'automatically' loaded!
    >
    > 2. Yes Billy does own most of the world but not ALL of it yet, Word is a
    > proprietary document, so again should never be 'automatically' loaded!
    >
    > 3. Word documents because of their formatting, scripting and proprietary
    > format a generally larger (most time many-fold) then plain text or html
    > counter parts and are not optimal for general web delivery especially if
    > 'automatically' loaded! Not everyone has broadband.
    >
    > 4. Lastly it is just bad etiquette akin to a tele-marketer's call at
    > diner-time. Be polite use a regular link with the file description and
    > file size noted
    >
    > <a href="pricelist.doc">Our Price List in MS Word200 format (1.2 MB)</a>
    > or in <a href="pricelist.txt">Our Price List in plain text (10 KB) </a>
    >
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIO
    > http://www.LittleWorksStudio.com
    hol, Feb 16, 2006
    #10
  11. Gazing into my crystal ball I observed "hol" <> writing in
    news:dt2hhf$v5n$:

    > Hi Jonathan, thanks for the comments,
    >
    > The problem is that my customer wants the site visitors to be able to
    > download his CV as a word file. This doesn't happen automatically but
    > only when a user clicks the appropriate button on the main Flash site.
    > This button opens an html page that loads the word document. As you can
    > see I have to go through this procedure.
    >


    Tell your customer politely to stop wanting that. Mention all the reasons
    others have mentioned. Always give the user (site visitor) a choice.

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne Boswell, Feb 16, 2006
    #11
  12. hol wrote:
    > Hi Jonathan, thanks for the comments,
    >
    > The problem is that my customer wants the site visitors to be able to
    > download his CV as a word file. This doesn't happen automatically but only
    > when a user clicks the appropriate button on the main Flash site. This
    > button opens an html page that loads the word document. As you can see I
    > have to go through this procedure.


    Why? In flash when you link a 'button' symbol to a URL is analogous
    adding a href to a A element, right? What's the action script getURL(),
    ( been a while! ) and link it to the Word doc direcly so the browser
    will treat as it would with a direct HTML link

    <a href="pricelist.doc">Our Price List in MS Word200 format (1.2 MB)</a>

    No need for external pages with auto popup windows,

    OR

    In the Flash have the button link to a download HTML page with your links

    button.getURL('mydownloadpage.html')

    and the mydownloadpage.html has plain links to docs as above.
    <a href="pricelist.doc">Our Price List in MS Word200 format (1.2 MB)</a>


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Feb 16, 2006
    #12
  13. On Thu, 16 Feb 2006, hol wrote:

    > The problem is that my customer wants the site visitors to be able to
    > download his CV as a word file.


    Then offer a straightforward link to the wretched thing from the web
    page (with a helpful note saying what format it's in), and leave the
    visitors to do whatever they do with such content.

    > This doesn't happen automatically


    We certainly hope not!

    > but only when a user clicks the appropriate button on the main Flash
    > site.


    Eh? Have you totally lost the concept of "web site"?

    > This button opens an html page


    Why aren't we on an HTML page to start with? This is getting
    increasingly silly.

    > that loads the word document.


    HTML is structured markup, it doesn't "load" anything: include a link
    to the wretched document: make sure that your server knows the correct
    content-type to send it out with, so that any www-compatible browser
    can handle it, leaving the "operating system component that thinks
    it's a web browser" to do its own thing as usual.

    It's all very straightforward for the user, just so long as you don't
    keep re-inventing perverse ways of doing things that the web has been
    doing without fuss since its early days.

    > As you can see I have to go through this procedure.


    As we can see, you don't know how to use Usenet either.

    [upside-down quotage snipped.]
    Alan J. Flavell, Feb 16, 2006
    #13
  14. hol

    Jose Guest

    > The problem is that my customer wants the site visitors to be able to
    > download his CV as a word file. This doesn't happen automatically but only
    > when a user clicks the appropriate button on the main Flash site.


    First problem is "main Flash site". If this means that the home page is
    flash, you have a serious problem with your client.

    Jose
    --
    Money: what you need when you run out of brains.
    for Email, make the obvious change in the address.
    Jose, Feb 16, 2006
    #14
  15. In article <Xns976C7428ED602arbpenyahoocom@69.28.186.121>,
    Adrienne Boswell <> wrote:
    >Gazing into my crystal ball I observed "hol" <> writing in
    >news:dt2hhf$v5n$:
    >
    >> Hi Jonathan, thanks for the comments,
    >>
    >> The problem is that my customer wants the site visitors to be able to
    >> download his CV as a word file. This doesn't happen automatically but
    >> only when a user clicks the appropriate button on the main Flash site.
    >> This button opens an html page that loads the word document. As you can
    >> see I have to go through this procedure.
    >>

    >
    >Tell your customer politely to stop wanting that.


    Hahahahahaha.

    I've been doing this since 1993 and lemme count the times THAT'S worked.

    Um, zero.

    >Always give the user (site visitor) a choice.


    That works. Do it and don't bother to mention it. Tell them
    "some poeple have macs and can't read it so I did this for free
    for you".

    What you usually find in the person knows 8 people and they
    all have word and they think the entire interweb runs on word
    and there is no talking them out of it because you're a dumb
    techie and he knows his target market. The latter half of
    this statement is actually often times true.



    --
    Need Mercedes parts ? - http://parts.mbz.org
    Richard Sexton | Mercedes stuff: http://mbz.org
    1970 280SE, 72 280SE | Home page: http://rs79.vrx.net
    633CSi 250SE/C 300SD | http://aquaria.net http://killi.net
    Richard Sexton, Feb 17, 2006
    #15
  16. Adrienne Boswell wrote:
    > Tell your customer politely to stop wanting that. Mention all the reasons
    > others have mentioned. Always give the user (site visitor) a choice.


    BUT be prepared to have the customer to go hire someone else that will
    give him/her exactly what they want.
    Travis Newbury, Feb 17, 2006
    #16
  17. hol

    hol Guest

    ? "Travis Newbury" <> ?????? ??? ??????
    news:...
    > Adrienne Boswell wrote:
    >> Tell your customer politely to stop wanting that. Mention all the
    >> reasons
    >> others have mentioned. Always give the user (site visitor) a choice.

    >
    > BUT be prepared to have the customer to go hire someone else that will
    > give him/her exactly what they want.
    >


    Couldn't agree more Travis. Looks like you've been in this business.

    Mark
    hol, Feb 20, 2006
    #17
    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. Fabio R.
    Replies:
    0
    Views:
    776
    Fabio R.
    Mar 25, 2005
  2. David Otton

    window.onload and body.onload differences

    David Otton, Nov 4, 2004, in forum: Javascript
    Replies:
    2
    Views:
    529
    Martin Honnen
    Nov 4, 2004
  3. Replies:
    5
    Views:
    250
    Thomas 'PointedEars' Lahn
    May 15, 2005
  4. marco

    onload -->* no onload

    marco, Jun 22, 2006, in forum: Javascript
    Replies:
    7
    Views:
    190
    marco
    Jun 24, 2006
  5. Replies:
    2
    Views:
    324
Loading...

Share This Page