JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Doorhanger clickjacking</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"
/>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<style>
#draggable {
display: inline-block;
padding: 0.5em;
cursor: move;
max-width: 250px;
left: 157px;
top: 6px;
}
#buttonContainer {
text-align:center;
}
output {
white-space:pre;
}
</style>
<script>
var textarea;
$(function() {
textarea = document.getElementsByTagName("output")[0];
$("#draggable").draggable();
});
function locCallback(aPosition) {
textarea.value += "Got location: " + aPosition.coords.latitude + " x " + aPosition.coords.longitude + "\n";
}
function errCallback(aError) {
textarea.value += "Got error: " + aError.code + " -- " + aError.message + "\n";
}
function getLocation() {
textarea.value += "Requesting location...\n";
navigator.geolocation.getCurrentPosition(locCallback, errCallback);
}
</script>
</head>
<body>
<div>
<div id="draggable" class="ui-widget-content">
<p>Drag me around to position the button below under the doorhanger's button.</p>
<div
id="buttonContainer">
<button onclick="getLocation()">Click Me</button>
</div>
</div>
</div>
<output></output>
</body>
</html>