Skip to Content

requestPosition()

Use the Google Maps API to request the user’s geolocation.

JavaScript February 22, 2017

Usage

JavaScript
 requestPosition()

Parameters

This function does not accept any parameters. Is this incorrect?

Source File

Located in /assets/js/nebula.js on line 3242.

Note: This function contains 1 to-do comment.

JavaScript
function requestPosition(){
    if ( typeof google !== 'undefined' && nebula.has(google, 'maps') ){ //@todo "Nebula" 0: Replace with optional chaining
        nebula.loadJS('https://www.google.com/jsapi?key=' + nebula.site.options.nebula_google_browser_api_key, function(){ //May not need key here, but just to be safe.
            google.load('maps', '3', {
                other_params: 'libraries=placeskey=' + nebula.site.options.nebula_google_browser_api_key,
                callback: function(){
                    nebula.getCurrentPosition();
                }
            });
        });
    } else {
        getCurrentPosition();
    }
}

Override

To override or disable this JavaScript function, simply redeclare it with the exact same function name.

JavaScript
function requestPosition(){
    //Write your own code here, leave it blank, or return false.
}