Geolocation

Opera supports the W3C Geolocation API [1], which provides a standard method for Web pages to query the browser for its current physical location.

Responding to geolocation requests

When a Web page uses the Geolocation API to ask Opera for its location, GOGI sends a GOGI_OPERA_EVT_ASK_PERMISSION event with a permission_type of GOGI_PERMISSION_TYPE_GEOLOCATION_REQUEST. At this point, the user should be prompted for permission to reveal this information to the server.

To allow the request without saving the answer for future requests, use the following callback:

struct GOGI_AskPermission ap = data->ask_permission; ap.callback(ap.data, TRUE, GOGI_AskPermission::GOGI_PERSISTENCE_TYPE_RUNTIME);

Privacy concerns

Opera will never provide geolocation information to a Web page without asking for permission first (unless the user has previously allowed the request with GOGI_PERSISTENCE_TYPE_SESSION in the same session or GOGI_PERSISTENCE_TYPE_ALWAYS).

If a user does not respond to a GOGI_OPERA_EVT_ASK_PERMISSION event, then no geolocation information will be provided to the Web page.

Limitations

IP lookup-based geolocation is the only method currently supported.

Known issues

In some cases, Opera may not remember persistency settings for the answers to geolocation requests. In this event, Opera will simply send a GOGI_OPERA_EVT_ASK_PERMISSION event for each geolocation request.

Disclaimer

The current implementation included in the CDK is in beta stage and should not be used in production code.

References

References
1 Geolocation API Specification
Editor's Draft 27 November 2009
World Wide Web Consortium (W3C) http://www.w3.org/TR/geolocation-API/