Synchronous XMLHttpRequest broke website today - xmlhttprequest

I got into work today and got a telling off from my boss because the company website wasn't loading properly on mobile. I looked in the console and saw the following error... Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.. I clicked the link https://xhr.spec.whatwg.org/#xmlhttprequest and the update was made yesterday (7th June 2016). How do I fix this error?

Usually the message you provided should not break a page from being rendered.
It just states that you should not use Synchronous XMLHttpRequest.
Synchronous requests will slow down rendering since the site has to wait for each request to complete in an iterative manner.
To "fix" that all your AJAX requests must be set to be async.

Related

How to implement a busy/progress page page on Express.js

I have a webapp created with Node.js/Express.js/Pug that runs a bash script(mostly an Nmap scan) and displays the results. I'd like to implement some sort of page in between the start and the results to signify the system is working on the task.
I tried to just add another res.render(...) at the beginning of the route that starts the scan, but I ran into the problem that HTTP cannot send headers twice. Effectively, I can't send two http responses for one request; please let me know if I'm wrong here.
I'm still not very familiar with this stuff; I'm working with a group and this job fell to me, any help is appreciated.
Typically the route handler would:
trigger the long running script asynchronously
return an "in progress" page
Then the "in progress" page would ask the server if it was done yet via:
Websocket
Ajax polling
Meta refresh polling
You'd need to have the callback to the original asynchronous process keep track of where the response should go to (possibly using a GUID that would be passed to it and also returned as data in the "in progress" page).

Failure to register a OneDrive file handler

I have been attempting to register a OneDrive File Handler as demonstrated on GitHub.
My initial PUT seems to work but I get very flaky results when I attempt to update. I have one domain where the handler works fine but another where I get these problems:
refresh works first time but not subsequently
refresh seems to work but handler not evident in OneDrive
change and update handler but changes not seen when I refresh
Is there any way to work out what is going on? The responses I get in Postman indicate that everything has worked but the file handler is not working.
Here are some observations which may help anyone else who stumbles on this:
the forceRefresh requests seems very patchy, I can make a change in the handler manifest and only some hours later will forceRefresh actually return the changed manifest
don't make the silly mistake I did and change the version in the handler manifest to something other than 2. If you do this the manifest will upload successfully but your handler will never appear. An error response would be much nicer than a silent fail.
I often find that even once forceRefresh has worked the new handler does not appear in my browser. To fix this I go to Local Storage (in the browser dev tools) and remove the entry for 'fileHandlerCache', then do a refresh.
BTW, handlers seem like a great way to extend OneDrive but I have found the developer experience to be pretty rough. Any chance of a smoother ride?

can gtk.LinkButton do a POST request?

I am working at a GPL botanical collection manager (bauble), and I am linking to some reference sites like the wikipedia, the plant list, and similar sites.
all the above handle requests as GET and for each of them I'm generating an URI which I am connecting to a gtk.LinkButton.
is it possible to link to sites only handling requests as POST? I'm wondering because I had to link to tropicos, and initially I had not found the way they handle GET requests.
I'm not working with pygtk any more. and I guess that if I still needed this (I don't), I should consider this: »By default, Gtk.LinkButton calls Gtk.show_uri_on_window() when the button is clicked. This behaviour can be overridden by connecting to the Gtk.LinkButton ::activate-link signal and returning True from the signal handler.«

python - HTTP Error 503 Service Unavailable

I am trying to scrape data from google and linkedin. Somehow it gave me this error:
*** httperror_seek_wrapper: HTTP Error 503: Service Unavailable
Can someone help advice how I solve this?
Google is simply detecting your query as automated. You would need a captcha solver to get unlimited results. The following link might be helpful.
https://support.google.com/websearch/answer/86640?hl=en
Bypassing Captcha using an OCR Engine:
http://www.debasish.in/2012/01/bypass-captcha-using-python-and.html
Simple Approach:
An even simpler approach is to simply use sleep() a few times and to generate random queries. This way google will not spot that you are using an automated system. But the system is far slower ...
Error Handling:
To simply get remove the error message use try and except
I encountered the same situation and tried using the sleep() function before every request to spread the requests a little. It looked like it was working fine but failed soon enough even with a delay of 2 seconds. What solved it finally was using:
with contextlib.closing(urllib.urlopen(urlToOpen)) as x:
#do stuff with x.
This I did because I thought opening too many requests keeps it open and had to closed. Nevertheless, it worked quite consistently with as less as 0.5s delay time.

WebAPI hangs indefinitely when receiving a POST with incorrect Content-Length in header

I have a project set up using ASP.NET WebAPI on top of Azure, and am having a problem whenever I try to make an HTTP Post where the content-length is too long in the header.
Normally I would've just ignored this problem, because you should be correctly setting the content-length on POST, but it turns out that when this happens, it causes the session to hang indefinitely, and then the Azure emulator crashes.
I have a custom JSON Formatter which extends MediaTypeFormatter, and I set a breakpoint on the first line of my implementation of OnReadFromStreamAsync(). However, the breakpoint is never hit because the hangup happens before ever hitting the JSON Deserializer.
I really have no idea where this hanging is occurring from because I receive no exception, just an indefinite hang and occasional Azure emulator crash.
Thank you in advance for any help or insight you might provide!
This sounds like a bug. The good thing is that you can get updated developer bits form codeplex.
There is a chance what your experiencing is related to one of these:
WebAPI: Stream uploading under webhost is not working
DevDiv 388456 -- WebHost should not use Transfer-Encoding chunked when
content length is known.
Zero ContentLength without content type header in body is throwing
If the updated bits don't fix your problem I suggest you try the standard media formatters to rule in/out your formatter. Failing that, then submit an issue.