By using document.referrer
we will get all the reference of URL in JavaScript, such as the following:
http://localhost/testwordpress/wp-admin/a
To get the query string from document.referrer, you can use the split() method:
var qs = document.referrer.split('?')[1];
if (typeof qs !== 'undefined') {
// qs contains the query string.
// this would be "page=thesis-options&upgraded=true" in your case.
}
else {
// there was no query string in document.referrer.
}