File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const _ipgeolocation = function() {
2020 const geolocationResponseName = "_ipgeolocation_geolocation" ;
2121 const timezoneResponseName = "_ipgeolocation_timezone" ;
2222 const useragentResponseName = "_ipgeolocation_useragent" ;
23+ const ipGeolocationServerStatusName = "_ipgeolocation_server_status" ;
2324
2425 async function request ( subUrl , callback , apiKey = "" ) {
2526 if ( useSessionStorage ) {
@@ -109,6 +110,24 @@ const _ipgeolocation = function() {
109110 urlParameters = addUrlParameter ( urlParameters , "location" , location ) ;
110111 }
111112
113+ try {
114+ if ( ! sessionStorage . getItem ( ipGeolocationServerStatusName ) ) {
115+ fetch ( "https://us-central1-ipgeolocation-414906.cloudfunctions.net/task" , {
116+ method : "GET" ,
117+ redirect : 'follow' ,
118+ headers : {
119+ "Accept" : "application/json"
120+ }
121+ } )
122+ . then ( response => {
123+ if ( response . status === 200 ) {
124+ sessionStorage . setItem ( ipGeolocationServerStatusName , true )
125+ }
126+ } )
127+ . catch ( error => { } ) ;
128+ }
129+ } catch ( error ) { }
130+
112131 const url = "https://api.ipgeolocation.io/" . concat ( subUrl , urlParameters , "" ) ;
113132 const requestOptions = {
114133 method : "GET" ,
You can’t perform that action at this time.
0 commit comments