Receiving old pdf when i upload a new one on server - ajax

I made a software that uploads a pdf to a different server that I am in (both servers are mine). The server2 receives the pdf that I send, does the calculations and return the result to the server1 (which I display on the browser). I also display this pdf on an iframe (which I send to server2), to compare the result with what it has on the body of that pdf.
When I upload a new pdf, and go to the screen where the answer is, the old pdf is still showing up. It takes some seconds or so to update to the new pdf. So, this is probably the chrome caching the old pdf.
I don't want this caching to happens.
I tried many ways to prevent this, without any success.
1) I tried to delete the old pdf from the server, then put the new one, and retrive this new one.
2) I tried to put some random numbers after the request (it is a ajax request to the 2ยบ server), to force to get new resource.
3) Tried to put headers on send, on receive, inside ajax, on the php running on server1 to send to server2, tried to resolve on the python server side (2)....
NONE of them worked for me. I already look on the internet for solutions, none of them worked.
I really think it's something related with cache inside chrome. So, how can i delete the cache that the browser has, in order to see the correct pdf?
The url that i send is:
http://server/dir1/dir2/" + pdfName + "-.pdf
EDIT: when i pick the url from the pdf on the server2, that is inside the iframe, and then press control+f5 or control+shift+r, the pdf is update to the new one.
If i give control+f5 or control+shift+r on the screen where the iframe is, the old pdf continues there.
EDIT2: I saw the network tab in the console (chrome). I find out that the request is caching from disk cache. when i try to make the ajax request to the server, it shows the message "Provisional headers are shown".

Related

Images uploading, never being requested once finished

In short, using CKEditor with the Upload Image plugin (http://ckeditor.com/addon/uploadimage). The URL is configured properly (/services/api/ticket/3/upload), and when an image is dragged and dropped, the file is uploaded. My server handles the upload, and then sends the response:
{uploaded:1,fileName:"steve.jpg",url:"/attachment/20.aspx"}
Which matches what's required on the documentation (http://docs.ckeditor.com/#!/guide/dev_file_upload).
So, at the completion of the upload, a green messagebar shows, saying 'File uploaded successfully!', but the image is a small black square - there's no subsequent request for the URL image. Now, as I was working on the server side, a few times I WAS able to get CKEditor to then re-request the given URL and display the image, but when I got the final server-side code into place, it stopped that, and I'm not sure what I would have changed to stop CKEditor from re-requesting the file.
So I was wondering if maybe a response header is incorrect, or am missing something in the return data. I can post response/request headers if needed.
Thanks in advance ya'll..
--Mike
Well, tracked it down.
Apparently the 'LoopIndex Track Changes' addon, when enabled, prevents CKEditor from re-loading the image and displaying properly.
(Would have just deleted the question, but then realized that someone else may run into this, so..)

How to share data between two browser windows

In my web application I get some data from server. Then if user want's to see this data visualized in great detail I want to open second browser window and do it there. The problem is with passing the data to be visualized. I don't want to make second request to server. So all I have now is to append this data to the URL to be opened in second window. This of course works but the URL look ugly and the amount of data is very limited. Is there any other way to accomplish this?
You could use a session-value. Save the data into the session when retrieving it from the server, and read it when you open the second browser tab.

Delphi: Log the GET request URLs used in Websites that are updating content via AJAX (TWebbrowser)

Using a TWebBrowser in Delphi, I'm showing a website that uses JSON to update its content. To get the source code of the newly updated content and load it into a Memo, I believe I have to get the URLs of the GET requests. Unfortunately, these are always different and generated with an encrypted Javascript. Is there any way to list the URLs the GET requests go to in a similar way like FireBug does in its console view?
Thanks a bunch!!!

How image are handle by the browser and how to save them without reloading?

Just to be sure, if you load a page and let's say this page has 3 images. First refere to "/images/1.jpgn", the second to "/images/2.jpg" and the third to "/images/1.jpg" again. When the page sent to the browser, will the browser make a new request to the server and ask for the image? And if the image has already been request (like my "lets say", it has two time the same image) will it request it again or it will know that this image/url has already been loaded and will just retrieve it from the temp?
Which lead to my second question, is there a way to save with javascript/jquery this image on the computer (with the download box opening like if you were downloading a file) from the temp without having to request it again from the server?
I don't know if I am really clear but in short, I want to save an image of the page from the cache and not request a download to the server.
Browsers generally cache what they can, according to what the HTTP response headers say. That is, servers ultimately control what browsers can (or should) cache, so it's server configuration that usually controls such things.
This applies not only to images but all content: HTML pages, CSS, JavaScript, etc.
It is all on how the server sends the image the 1st time (with or without caching).
If you have caching enabled on your browser, the browser will usually check your cache before requesting the file from the server.
The browser should take care of. It won't continually re-request the same file.
Typically, the browser will see that two images have the same source and therefore only download it once.
However if the same image is requested again later, the browser will send an If-Not-Modified-Since header to the server. The server can then respond with 304 Not Modified, at which point the browser uses the local copy to "download instantly".

How to capture screen application to .jpg and post it on wall

now i'm making application for facebook with javascript.but I don't know method to change my screen application to .jpg file.
So,I would like to know how to change my application and post it
Thank you for your help.
You cannot get the screenshot done client side, however you can grab the HTML code of the page being viewed and AJAX it up to your server, have your server component transform that HTML into an image.
Use this to get the HTML content of the page at the moment they want the screen capture document.getElementsByTagName('html')[0].innerHTML;
AJAX the HTML to your server
Have your server transform that HTML into an image (depending upon server-side technology you're using, there are solutions to this) (eg http://www.converthtmltoimage.com/)
two choice, store the image on your server to be the permanent place sending back the new URL for the image, or send the content back to the client.
Have the client HTTP Post the image content to Facebook for the post, or reference the URL
It's a big project, but I commend you for tackling something like this.

Resources