Re: What's Up With XMLHttpRequest?
"Sayed Arian Kooshesh [email protected] [svg-developers]" <[email protected]> Fri, 23 Jan 2015 17:02:26 -0600
| Newsgroups | gmane.text.xml.svg.devel |
|---|---|
| Message-ID | <CAC30Oviy5jq=vWt7MJCWcvf0VitM_7Am00_PkyUrZjWXvigbxA@mail.gmail.com> |
sync based http request lock up the browser as javascript is single threaded so until that request returns you page will not do anything else and appear frozen to the user. On Fri, Jan 23, 2015 at 4:28 PM, [email protected] [svg-developers] < [email protected]> wrote: > > > It appears that because I use this function it is being removed from the > web platform, but seriously... > > I am not a programmer or Javascript pro. I am currently using this script; > > <script type="text/javascript"> > function load_container(temp) { > var req = new XMLHttpRequest(); > req.open("GET", temp, false); > req.send(null); > var page = req.responseText; > document.getElementById("container").innerHTML = page; > </script> > > My browser developer tools tell me this is determental to the user > experience. Huh? Can anyone clarify the reason and perhaps tell me how to > properly write the script to be compliant with whoever is upset? > > SynchronousXMLHttpRequest <https://xhr.spec.whatwg.org/#xmlhttprequest> > outside of workers is in the process of being removed from the web platform > as it has detrimental effects to the end user's experience. (This is a long > process that takes many years.) Developers must not pass false for the > async argument when the JavaScript global environment > <https://html.spec.whatwg.org/multipage/infrastructure.html#javascript-global-environment> > is a document environment > <https://html.spec.whatwg.org/multipage/webappapis.html#document-environment>. > User agents are strongly encouraged to warn about such usage in developer > tools and may experiment with throwing > <http://heycam.github.io/webidl/#dfn-throw> an InvalidAccessError > exception when it occurs. > > Thanks in advance. > > James > http://svgdesign.guru > > > >