www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 27

Thread: What wrong is the excel link?

  1. #1
    Join Date
    Jun 2012
    Posts
    19

    What wrong is the excel link?

    Referring to following link, I would like to bookmark the download link for Excel file. Based on following source code, when I try to paste following code into URL, there is no excel file to be downloaded.

    Does anyone have any suggestions on how to get the code for bookmark?

    Any help will be greatly appreciated :>

    <img src="../../resources/images/common/Excel.png" id="cp_imgExcel" class="btn" onclick="window.location.href='dbindepth.aspx?country=66970&amp;startdate=2011/02/11&amp;enddate=2012/08/11&amp;indicator=71&amp;excel=1'"/>&

    http://www.aastocks.com/tc/forex/mar...or=71&period=3

    http://www.aastocks.com/tc/forex/mar...71&amp;excel=1'

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    Bookmarks don't work the same in all browsers.

    I use PHP to force a download.

    PHP Code:

    <?php
    header
    ('Content-disposition: attachment; filename=myfile.xls');
    header('Content-type: application/xls');
    readfile('myfile.xls');
    ?>
    HTML Code:
    <a href="downloadxl.php">Download my excel sheet (XLS)</a>

  3. #3
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096

  4. #4
    Join Date
    Jun 2012
    Posts
    19
    When I click on the Excel icon, I can able to download the file,
    Do you have any suggestions on how to get the link from the source code?
    so I can download the file using some other script.
    Thanks you very much for any suggestions

  5. #5
    Join Date
    Jun 2012
    Posts
    19
    Quote Originally Posted by donatello View Post
    Bookmarks don't work the same in all browsers.

    I use PHP to force a download.

    PHP Code:

    <?php
    header
    ('Content-disposition: attachment; filename=myfile.xls');
    header('Content-type: application/xls');
    readfile('myfile.xls');
    ?>
    HTML Code:
    <a href="downloadxl.php">Download my excel sheet (XLS)</a>
    Even through you use PHP to force a download, you still need to hardcode the link into it, do you have any suggestions on what code you would retrieve from above example?
    Thanks you very much for any suggestions

  6. #6
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    My previous post had a link to a script I use where the PHP script will download any file from a particular directory.

    http://www.zubrag.com/scripts/download.php/

    Then you simply add the filename to the query string.
    I'm using it here:
    http://companypolicies.org/privacy-policy-template/

    THIS SITE IS IN TESTING AND NOT COMPLETE - only for demo...

  7. #7
    Join Date
    Jun 2012
    Posts
    19
    Referring to following coding, it is ASP.NET, not PHP, so it would not work,
    Do you have any suggestions on what code you would retrieve from above example?
    Thanks you very much for any suggestions


    dbindepth.aspx?

  8. #8
    Join Date
    Jan 2009
    Posts
    3,346
    Quote Originally Posted by oem7110 View Post
    Referring to following link, I would like to bookmark the download link for Excel file. Based on following source code, when I try to paste following code into URL, there is no excel file to be downloaded.

    Does anyone have any suggestions on how to get the code for bookmark?

    Any help will be greatly appreciated :>

    <img src="../../resources/images/common/Excel.png" id="cp_imgExcel" class="btn" onclick="window.location.href='dbindepth.aspx?country=66970&amp;startdate=2011/02/11&amp;enddate=2012/08/11&amp;indicator=71&amp;excel=1'"/>&

    http://www.aastocks.com/tc/forex/mar...or=71&period=3

    http://www.aastocks.com/tc/forex/mar...71&amp;excel=1'
    It is possible the server is trying to prevent hotlinking...meaning you might have to initialize a session first...

  9. #9
    Join Date
    Jun 2012
    Posts
    19
    Quote Originally Posted by criterion9 View Post
    It is possible the server is trying to prevent hotlinking...meaning you might have to initialize a session first...
    Do you have any suggestions on how to initialize a session?
    Thanks everyone very much for any suggestions

  10. #10
    Join Date
    Jan 2009
    Posts
    3,346
    They may not want you to be hotlinking to their documents. I would suggest asking them for an API if you are planning to use their contents in any way.

  11. #11
    Join Date
    Jun 2012
    Posts
    19
    Quote Originally Posted by criterion9 View Post
    They may not want you to be hotlinking to their documents. I would suggest asking them for an API if you are planning to use their contents in any way.
    I would like to know what coding I can tell that web site does not wany me to be hotlinking to their documents.

    Can you tell what the code looks like based on the source code from above questions?

    Thanks everyone very much for any suggestions

  12. #12
    Join Date
    Jan 2009
    Posts
    3,346
    I good way to tell that they don't want hotlinking is if you copy the URL used to get the document and when pasting it into a freshly opened browser you don't get the document as expected.

  13. #13
    Join Date
    Jun 2012
    Posts
    19
    Quote Originally Posted by criterion9 View Post
    I good way to tell that they don't want hotlinking is if you copy the URL used to get the document and when pasting it into a freshly opened browser you don't get the document as expected.
    But sometimes, people can still sort out the URL for hotlinking from source code to get the document, referring to this example, could you please give me any suggestions on what command prevents people sorting out the URL for hotlinking?

    Thanks everyone very much for any suggestions

    <img src="../../resources/images/common/Excel.png" id="cp_imgExcel" class="btn" onclick="window.location.href='dbindepth.aspx?country=66970&amp;startdate=2011/02/11&amp;enddate=2012/08/11&amp;indicator=71&amp;excel=1'"/>&

  14. #14
    Join Date
    Aug 2012
    Posts
    3
    Hi everyone ,

    I am agree with everyone and need to more suggestion about these topic...


    The given code is good, i have learned a lot...

    Thanks a lot need more posting to learn

  15. #15
    Join Date
    Jan 2009
    Posts
    3,346
    Quote Originally Posted by oem7110 View Post
    But sometimes, people can still sort out the URL for hotlinking from source code to get the document, referring to this example, could you please give me any suggestions on what command prevents people sorting out the URL for hotlinking?

    Thanks everyone very much for any suggestions

    <img src="../../resources/images/common/Excel.png" id="cp_imgExcel" class="btn" onclick="window.location.href='dbindepth.aspx?country=66970&amp;startdate=2011/02/11&amp;enddate=2012/08/11&amp;indicator=71&amp;excel=1'"/>&
    Something they are doing server side is probably preventing the hotlinking. I'm not going to tell you how to work around it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles