Geolocation error callback in Google chrome

There is a strange bug (or feature?) in Google chrome browser (19.0.1084.56 m). I'm trying to run the next JavaScript code on my page:

//...
function successCallback(position) {
    console.log('success');
}

function errorCallback(error) {
    console.log('error');
}

navigator.geolocation.getCurrentPosition(
    successCallback,
    errorCallback,
    {timeout: 1000});
//...

Browser ask me: "sitename wants to track your physical location [Allow] [Deny] ... Learn more [X]".

When I click on the Allow/Deny buttons the callback functions work fine. But when I click on the [X] button nothing happens :( Is there any way to detect click on the [X]?

PS Looks like Firefox has the same feature Firefox 11 and GeoLocation denial callback

Answers


I believe Chrome doesn't have callback for ignore option.

If I were you, I'd try to implement a timeout callback.

Example code:
    _callback = false;
function successCallback(position) {
    _callback = true;
    console.log('success');
}

function errorCallback(error) {
     _callback = true; 
    console.log('error');
}

setTimeout(function(){if(!_callback)console.log('ignored')}, 10000); //chanche the timeout according your needs

navigator.geolocation.getCurrentPosition(
    successCallback,
    errorCallback,
    {timeout: 1000});

Need Your Help

Copying a single file then renaming it using maven-resources-plugin -- possible?

maven maven-resources-plugin

I copy a single WSDL file from a different project tree, using maven-resources-plugin, as follows:

Is this a typo? private _MyEntities => new MyEntities();

c# entity-framework

I'm fixing a bug in some inherited code. There's a class which has a module-scoped variable which is an Entity Framework DataContext.