Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7492191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:23:26+00:00 2026-05-29T16:23:26+00:00

This is what I want to do: I want to send an HTTP request

  • 0

This is what I want to do:

I want to send an HTTP request to a server, potentially returning a PDF file. But the server may also just return an error code (PDF file unavailable, PDF file invalid, PDF system down, etc). When I get the PDF, I would like to open the PDF and refresh the page that loaded the PDF, because the PDF is then marked as “read”. When I get an error code (or timeout), I would like to redirect the page to an error screen. Downloading Google Chrome works in a similar manner:

http://www.google.com/chrome/eula.html?hl=en&platform=win

This is what I don’t want do:

For performance reasons, I don’t want to issue two requests as suggested in this question here:

Download and open pdf file using Ajax

Two requests can mean:

  1. Make a request for the PDF and return a code to indicate whether the PDF is available or not. If unavailable, immediately display an error page
  2. If it is available, open a window and request the PDF again in that window, and display it.

That’s expensive because the PDF’s have to be accessed via remote systems. I don’t want to access the PDF resource twice. Another solution involving two requests:

  1. Make a request for the PDF and retrieve an error code or a temporary URL where the PDF is cached. On error, immediately display an error page
  2. If the PDF is available, open a window in which the cached PDF is displayed.

This will require for quite a large cache for the PDF’s

This might be an interesting lead:

I found this question here giving me some information about how I could download the binary data and make it available in JavaScript as binary data:

Is there a way to read binary data in JavaScript?

Maybe that’s a nice lead, but of course it won’t solve my problem yet, as I want to use the browser’s default editor to open the file, just as if I had requested the file from a normal URL.

So the question is:

Can I download binary data and open them like a regular document from JavaScript? If not, I’ll cache the document in some managed memory container in Weblogic and just hope that this won’t kill our system. Please only respond:

  • If you know for sure it cannot be done (some links explaining why would be nice)
  • If you know how to do it
  • If you have a different solution doing roughly what I want to do (not issuing two requests)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:23:28+00:00Added an answer on May 29, 2026 at 4:23 pm

    The implemented “old-school” solution works like this:

    1. The JavaScript client sends an AJAX request to the server to “prepare” a PDF document
    2. The server responds with any of these three messages:
      • a) Document available at URL http://www.example.com/doc.pdf
      • b) Document unavailable
      • c) Document being “prepared” (i.e. client has to wait)
    3. The JavaScript client then reacts as such:
      • a) Open the returned URL in a new window, refresh the current window after 5 seconds
      • b) The current window is redirected to an error screen
      • c) The current window stays unchanged and AJAX polling is implemented to repeat step 2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to send this URL as a request to the server to change
I have a text file that I want to send over the network, this
I am trying to send an HTTP request with the contents of a file
Does it send an HTTP GET request for the specified file? I'm trying to
Here the simple webserver means a server that deal with simple HTTP request, just
I want to send chunked HTTP body to test my own HTTP server. So
I want to monitor all the http request send from my chrome browser, and
Problem I want to send https request to the site https://10.2.20.20/fido/EzPay/login.php my own server
Consider this at the windows commandline. scriptA.py | scriptB.py I want to send a
I have this form. Basically what I want is to send a auto-response with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.