View Full Version here: : HTML Guru's
Tandum
18-04-2013, 09:49 PM
I'm running a little project here using an ardunio board to email me when the garage door has been open too long. It all works fine and once the iPhone email toots, I can go to safari, point at the ardunio and click a button on the web page it returns to close the door.
My problem is once I click the button, the address in safari changes from 10.0.5.25 to 10.0.5.25/?T=T which is the close door command. If I don't do a back in safari before closing the phone, it stays on the command address next time I look at it and I don't want that.
Here is the page source from the ardunio :
<!DOCTYPE HTML>
<form method="get">
<div style="width:100%; height:100%">
<button type="submit" style="height: 200px; width: 800px; font-size:500%; margin: -10px -25px; position:relative; top:25%; left:10%; " name="T" value="T">Door Clicker.</button>
</div>
<br />
</form>
Lots of size commands to get a big button in the middle of the screen.
What do I need to send it back to the initial address after pressing the button? Any clues?
troypiggo
18-04-2013, 10:09 PM
Can you change the form method to "post" instead of "get". That way the arguments don't get passed via the URL. Bit hard to answer without knowing more about the rest of the app. You don't have an action in there.
Tandum
18-04-2013, 10:18 PM
I tried post but the code triggers on ?T and I don't see that coming from a post. I dump everything coming from the client to serial so I can see it all on the side and using post I don't see any T's at all?
I'm just using html cos it's there and I can't write an iphone app without a mac. But it's basic coms, The client sends a html get and the button code I posted is returned. If the button is pressed the client sends ?T=T in the get request.
action tells it which web site to send the request to and doesn't do anything in this case.
I'll try spitting it some jscript to push it back.
troypiggo
18-04-2013, 10:32 PM
Can you use a refresh something like this to refresh the page every 3 secs. So you can click, get the ?T you need, then it cleans up the URL.
<!DOCTYPE HTML>
<meta http-equiv="refresh" content="3; url=http://10.0.5.25">
<form method="get">
<div style="width:100%; height:100%">
<button type="submit" style="height: 200px; width: 800px; font-size:500%; margin: -10px -25px; position:relative; top:25%; left:10%; " name="T" value="T">Door Clicker.</button>
</div>
<br />
</form>
Tandum
18-04-2013, 10:38 PM
I did try that and got multiple ?T 's coming in once the button was pressed but I'll have another look tomorrow. I don;t think I had the url= in it. Cheers
I also ordered snow leopard off apple to try a hackintosh :)
troypiggo
18-04-2013, 10:41 PM
Hope that does it for you. It worked here. The ?T=T appears initially after clicking the button, then after 3 secs (or whatever delay you want) goes back to the "url=...". Keep in mind it'll keep refreshing every 3 secs, not just once after 3 secs and stop. So maybe make the delay long as you think needed?
Tandum
18-04-2013, 10:46 PM
I initially used a 5 sec refresh while writing it up. It really needs a refresh so it can tell you the door is closing, the light is on etc. All a waste of time once the boy child moves out of course :)
Tandum
19-04-2013, 02:25 PM
Troy,
<meta http-equiv="refresh" content="3; url=http://10.0.5.25">
This line did work, after some sleep I saw I left out the ; after the time value.
It was then triggering twice for some reason but I hacked around that.
All working now :) Cheers.
troypiggo
19-04-2013, 04:21 PM
Awesome :)
vBulletin® v3.8.7, Copyright ©2000-2025, vBulletin Solutions, Inc.