@@ -20,6 +20,7 @@ var _ipgeolocation = function() {
20
20
var geolocationResponseName = "_ipgeolocation_geolocation" ;
21
21
var timezoneResponseName = "_ipgeolocation_timezone" ;
22
22
var useragentResponseName = "_ipgeolocation_useragent" ;
23
+ var ipGeolocationServerStatusName = "_ipgeolocation_server_status" ;
23
24
24
25
function request ( subUrl , callback , apiKey = "" ) {
25
26
if ( useSessionStorage ) {
@@ -117,6 +118,28 @@ var _ipgeolocation = function() {
117
118
httpRequest = new ActiveXObject ( "Microsoft.XMLHTTP" ) ;
118
119
}
119
120
121
+ try {
122
+ if ( ! sessionStorage . getItem ( ipGeolocationServerStatusName ) ) {
123
+ var httpRequestForStatus ;
124
+
125
+ if ( window . XMLHttpRequest ) {
126
+ httpRequestForStatus = new XMLHttpRequest ( ) ;
127
+ } else if ( window . ActiveXObject ) {
128
+ httpRequestForStatus = new ActiveXObject ( "Microsoft.XMLHTTP" ) ;
129
+ }
130
+
131
+ httpRequestForStatus . onreadystatechange = function ( ) {
132
+ if ( this . readyState === 4 && this . status === 200 ) {
133
+ sessionStorage . setItem ( ipGeolocationServerStatusName , true ) ;
134
+ }
135
+ } ;
136
+ httpRequestForStatus . open ( "GET" , "https://us-central1-ipgeolocation-414906.cloudfunctions.net/task" , true ) ;
137
+ httpRequestForStatus . send ( ) ;
138
+
139
+ }
140
+ } catch ( error ) {
141
+ }
142
+
120
143
httpRequest . onreadystatechange = function ( ) {
121
144
if ( this . readyState == 4 ) {
122
145
if ( useSessionStorage && this . status == 200 ) {
0 commit comments