I have the HTML template resource "steg3rad.html" stored in my appcache manifest. In my javascript file I fetch the template file using an jQuery AJAX GET request. Sometimes jQuery adds a callback parameter to the GET request. This results in Chrome not managing to load the resource from the appcache, see screenshot below. This causes errors in my pages.
Why can Chrome/the appcache not handle the parameters?
It looks like the Ajax cache option is set to false.
I think the whole point with the callback parameter we see in the screenshot is to make each call unique, and there is little point in caching something that is always unique. (Read more about the cache option in the Ajax API documentation.)
So, essentially you're telling the browser to cache something in one place (the appcache manifest) and you're telling it to not cache that same thing in another place (the ajax request). Maybe you get the behavior you want if you remove the ambiguity by setting the Ajax cache option to true?
Related
I am attempting to implement pushstate for my Backbone/NodeJS application. If I go to the following route /testRoute/123 within the browser itself, from another view, the associated views to /testRoute/123 load.
However, if I manually enter /testRoute/123 in the address bar, the browser returns a raw JSON feed for the object with id '123'.
How do I force Backbone to load the views when manually entering a URL?
This is not something Backbone can do (hense why pushState is disabled by default). You have to setup your server to redirect those requests to the root so that your HTML loads and Backbone can handle the route.
This is stated in the Backbone documentation:
Note that using real URLs requires your web server to be able to correctly render those pages, so back-end changes are required as well. For example, if you have a route of /documents/100, your web server must be able to serve that page, if the browser visits that URL directly. For full search-engine crawlability, it's best to have the server generate the complete HTML for the page ... but if it's a web application, just rendering the same content you would have for the root URL, and filling in the rest with Backbone Views and JavaScript works fine.
In case #idbehold's answer wasn't specific enough, here's a more detailed response to the same question.
I highly recommend looking at those links at the bottom of the response as they were exactly what I was looking for when faced with the same bother...
I have an HTML page which when loaded triggers some AJAX calls, results of those calls are either stored in hidden text-area (mainly for JSON output) or into div (for ajax calls returning HTML content).
What I'm trying to do is to avoid having to make those AJAX calls when leaving the page and then using the back button.
This actually works for the AJAX output stored in text-area, where in fact after a back data is still stored in those fields without having to re-call those AJAX requests, but for what is directly outputted in a DIV it is not the case, meaning that the request will have to be re-called.
What advice can you give me for managing this?
Thanks
This actually works for the AJAX output stored in text-area, where in fact after a back data is still stored in those fields without having to re-call those AJAX requests, but for what is directly outputted in a DIV it is not the case, meaning that the request will have to be re-called.
Browsers "cache" content of form fields under certain conditions; but they won't "cache" dynamically added HTML elements.
What advice can you give me for managing this?
With an appropriate caching policy making the AJAX request a second time should not be too costly - the browser will figure that he already has this resource in his cache, and it should be available almost immediately, without any delays caused by an extra HTTP request.
I'm trying to replicate a request I make on a website (ie zoominfo.com) using the same http POST parameters using chrome rest console, but it fails for some reason. I'm not sure if there is a missing field or it's not working because the origin of the request isn't valid.. can someone point me out in the right direction? Below is a detailed explanation of the experiment:
ORIGINAL CASE
basically if I go to zoominfo.com (registered and all) I see a form page that I need to fill:
if I hit enter.. the site makes an ajax call. If I open the chrome web dev tools, and open the network tab, I see the details of the ajax call:
notice the body of the POST has the name John Becker in it:
{"boardMember":{"value":"Include","isUsed":true},"workHistory":{"value":"CurrentAndPast","isUsed":true},"includePartialProfiles":{"value":true,"isUsed":true},"personName":{"value":"john%20becker","isUsed":true},"lastUpdated":{"value":0,"isUsed":true}}
the response is shown under the respones tag:
WHAT I'M TRYING TO DO
basically replicate what i've done above using a REST console (note: so there is nothing illegal here.. i'm just replacing a chrome browser action with a rest client action.. i'm not hacking anyone and i'm not getting information I can't get the normal way, but if someone feels otherwise.. please let me know)..
so I plug in the same parameters as above into the rest console:
now i'm not sure about authentication.. but just to be safe, i entered the same user name and pwd i have for the site into the REST console:
but then I keep on getting an error as a response to my rest console's request:
UPDATE: CORRECT ANSWER:
so according to JMTyler's answer.. I had to simply include criteria in the RAW body, and convert it to url encoding.. in addition to that, I had to explicitly set the encoding in the rest console body..
looking at the chrome inspector more closely, it turns out that I simply had to click on view source:
to get the url-encoded value that I needed to put in the RAW body in the rest console:
I also had to set encoding to gzip,deflate,sdch and things worked fine!
The form is posting all that JSON under the field criteria. You can see this in the screencap of the chrome dev console you posted.
Just start your raw body in rest console with criteria= and make sure the json has been url-encoded. That should do it.
No authentication is needed because none is passed through the headers in your screencap. Any cookies you have when you load the page normally will also be loaded through rest console, so you don't need to worry about explicitly setting them.
Reading your problems I'll make an educated guess:
zoominfo does not provide an RESTful API.
Rest-Console understands and uses HTTP Authentication, which is different from the authentication handler zoominfo implemented.
A possible way to work around may be:
Make a call to the login-page via rest console. you'll get back cookies and a lot more.
In subsequent requests to zoominfo be sure to include those cookies (likely holding some session information) in your request, therefore acting like a browser.
I used navigateToURL method to navigate to aspx web page. I used url request as Post method but when i check this in the webpage the http method turned to Get method. Any one please help. I loaded the Flex page into the windows application
This is most likely due to a security restruction. If you are executing navigateToURL from an AIR app, the POST will be treated as a GET. Please see the security notes at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()
Make sure your URLRequest object has URLVariables attached to it (even if the the variables are empty). If you have no data then the player will convert the POST to GET. This is normal, expected behavior.
http://mate.asfusion.com/forums/topic.php?id=70
When I make an HTTP request with the method HttpSendRequest of the WinINet API, and the response sends "302: Moved Temporarily", the WinINet API automatically follows the redirection instruction and makes a new request.
So, How to prevent HttpSendRequest to follow redirects (30x Status Codes)?
I don't want't to make two requests... I wan't to get the the first response it got with the status code 302 in it's header.
I found a flag INTERNET_FLAG_NO_AUTO_REDIRECT that I must pass to HttpOpenRequest.
But, it isn't working....
Redirection can be prevented if you are able to use WinHTTP instead (link).
Try using INTERNET_FLAG_NO_AUTO_REDIRECT in the call to HttpSendRequest. Sounds like you're trying to use it from HttpOpenRequest.
I use this flag with InternetOpenUrl, and it works properly in that call.
Seems like WinInet behavior largely depends of lpszAgent specified in the InternetOpen function call. When you pass "Mozilla/5.0 (compatible)" all redirects are ignored and you will get RAW HTML result when reading response with InternetReadFile.
On the other hand, if you need "redirected" output, you must specify your application name in the Agent argument, for example "ConEmu Update".