var qry = window.document.location.href;
The location object is part of the window object and is accessed through the window.location property.
Note: There is no public standard that applies to the location object, but all major browsers support it.
See their first sentence. You should try
var qry = window.location.href;