Reputation: 669
Im tying to make a simple site that will control my android phone using a combination of tasker and autoremote. Opening this link:
will make my Phone say "forward". I will have 4 buttons, forward, left, right, back. Its for a simple school project where a person wearing a blind fold will be controlled by my phone saying directions.
I need a button that will open that url but not go to the site or leave my site. Is this posable?
Upvotes: 1
Views: 78
Reputation: 2408
You could use JavaScript to send an AJAX request in the background to that page.
In your HTML you could have something like this:
<input type="button" value="Forward" class="movement-btn-f" /><br />
<input type="button" value="Back" class="movement-btn-b" /><br />
<input type="button" value="Left" class="movement-btn-l" /><br />
<input type="button" value="Right" class="movement-btn-r" />
Then in your JavaScript, something like this:
$(document).ready(function() {
$('.movement-btn-f').click(function() {
$.get("your forward URL here");
});
$('.movement-btn-b').click(function() {
$.get("your back URL here");
});
// etc...
});
To use that you'd need to include the jQuery library (see: http://www.jquery.com).
You might want to check out the documentation (http://api.jquery.com/jquery.get/) and see how you could use the success callback to wait for a command to be sent and block others in the meantime, but that depends on your application.
Upvotes: 1