Synchronous XMLHttpRequest Error - Agent webpage

Has anyone come across this error?

“Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience”

Coming from Firefox debug console. Using:

<script type=""text/javascript""> // Imp scripts function sendToImp(value){ if (window.XMLHttpRequest) {devInfoReq=new XMLHttpRequest();} else {devInfoReq=new ActiveXObject(""Microsoft.XMLHTTP"");} try { devInfoReq.open('POST', document.URL, false); devInfoReq.send(value); } catch (err) { console.log('Error parsing device info from imp'); } }</script>

serving a webpage over the agent. I didn’t know if anyone has come across this. Should I be using AJAX? I thought I read somewhere that AJAX exposes the url if page source is viewed (could be wrong…)? Thanks…

Also says no element found, on line1:1. Can it not find the page again? Maybe Im missing something… Just didn’t know if there was a quick fix someone figured out… Everything was fine using that method when website was simple, but now I’m adding event listeners, and some other stuff and not sure if Im doing something crazy…

The error (when it first occurs on the first instance) causes the webpage (or agent) to “freeze”. But after about 1 minute (approx) everything keeps working again…

The warning message is telling you that synchronous XMLHTTPRequests should not be used because they are not a great experience for the user. In other words - yes, you should be using AJAX (Asynchronous Javascript And XML).

When you make an AJAX request (or any other kind of request for that matter) - you necessarily expose the URL of the resource you’re making a request to. Based on the code you provided, it looks like you’re serving the webpage out of the agent, which means that people will already know the URL…

If you’re new to web development, I would highly encourage you to take a look at some free Javascript / web development courses from Treehouse, Code School, or other similar sites.