chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
	if (request == "getCurrentLocation") {
		latlon = document.getElementsByClassName('olControlMousePosition')[0].innerHTML;
		latlon = latlon.replace(' ', '').split(',');
		sendResponse({
			lat: latlon[0],
			lon: latlon[1]
		});
	}
});
var mousePosition;

document.addEventListener("mousedown", function(e) {
	if (e.button == 2) {
		var p = document.getElementsByClassName('olControlMousePosition')[0].innerHTML.replace(' ', '').split(',');
		mousePosition = {
			lat: p[0],
			lon: p[1]
		};
	}
});

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
	if (request == "getCurrentLocation") {
		sendResponse(mousePosition);
	}
});
Save mouse position on right click
Save mouse position on right click
