How to keep browser autocomplete from triggering REST calls? [Solved]

In the Bridge example, I've seen that a call like http://xxxxxxx/arduino/digital/13/1 can turn on the digital pin 13, and http://xxxxxxx/arduino/digital/13/0 can turn the pin off.

My browser (Safari) autocompletes URLs, so if I start typing, and it starts autocompleting, it will trigger the REST calls before I'm ready (which isn't a big deal for the Bridge example, but may be for my project).

What are some possible ways to modify the Bridge code if I only want the REST command to work once I press return on the browser?

trippingly: ::::SNIP::::

What are some possible ways to modify the Bridge code if I only want the REST command to work once I press return on the browser?

@trippingly, you could add code to the Bridge side of the listener, but that could get messy. The best thing to do is add BOOKMarks on your browser. I use firefox; most people I know use chrome (get developer options or versions). With both you can turn off, the "prediction" or modify it. I suspect you can do the same with Safari.

Does this help?

If you feel like adding pain to your process, you can add a randomizer to your URL call, and have the bridge side ignore that data. Again messy.

Jesse

I don't understand the problem. On any browser, including Safari, as I type a previously used URL, the autocomplete function starts proposing compete URLs, but nothing gets sent to the remote board until I hit enter or go. I've never seen this to be a problem with any browser, including Safari, or with any remote host, including the Yun.

Are you sure the call is being sent to the a Yun early, or are you just concerned when the address bar starts to get filled in automatically?

ShapeShifter: Are you sure the call is being sent to the a Yun early, or are you just concerned when the address bar starts to get filled in automatically?

I don't know what the mechanism is. Here's the symptom on my machine, though. Let's say pin 13 is currently off, I've previously visited http://xxxxxxx/arduino/digital/13/1, and that this URL is Safari's top suggestion for autocomplete as I start typing "http:/xxxxxxx/ard..." What I'm seeing is that as soon as the autocomplete suggests http://xxxxxxx/arduino/digital/13/1, the pin 13 goes to HIGH.

@jessemonroy650 - I think the bookmark idea would work to avoid this (because I wouldn't be typing the URL), though I'm curious if there's a code workaround.

Also, as far as turning off the autocomplete on my Safari, that might well work, too. Right now, I have the autofill preferences all turned off, and it still autocompletes and triggers the REST...but that might just be a Safari problem :grin:

trippingly: I don't know what the mechanism is. Here's the symptom on my machine, though. Let's say pin 13 is currently off, I've previously visited http://xxxxxxx/arduino/digital/13/1, and that this URL is Safari's top suggestion for autocomplete as I start typing "http:/xxxxxxx/ard..." What I'm seeing is that as soon as the autocomplete suggests http://xxxxxxx/arduino/digital/13/1, the pin 13 goes to HIGH.

@jessemonroy650 - I think the bookmark idea would work to avoid this (because I wouldn't be typing the URL), though I'm curious if there's a code workaround.

::::SNIP::::

@trippingly, it's possible that the browser is doing a If-Modified-Since request while your are typing. This would be consistent with the behaviour your getting. And since the webserver uhttpd is a minimal server, it might be getting confused with that request, likely because it is ignoring that part of the HTTP header.

If you are truely curious, You can start here. This is documentation I have not released, but it tells you how to get to source trees.

On getting around this "Safari" annoyance, I would suggest a bookmark. The other solution with code is to add a random number to the end of the URL. This is a common cache busting technique, but I am not confident with this idea. The other idea is to clear recent URL history.

Jesse

trippingly: I don't know what the mechanism is. Here's the symptom on my machine, though. Let's say pin 13 is currently off, I've previously visited http://xxxxxxx/arduino/digital/13/1, and that this URL is Safari's top suggestion for autocomplete as I start typing "http:/xxxxxxx/ard..." What I'm seeing is that as soon as the autocomplete suggests http://xxxxxxx/arduino/digital/13/1, the pin 13 goes to HIGH.

Curious. I've never seen this behavior. Autocomplete, yes; but not early URL transmission...

Solved!

It's a Safari feature... under Safari > Preferences > Search, there's an option for "Preload top hit in the background." (I'm running Safari v8.0.3 on a Mac.)

That option was turned on, so Safari was indeed transmitting the URL before I hit return. Unchecking the box solved the problem.

Interesting feature. Yeah, that's one option I would leave turned off (especially since I have very limited bandwidth and wouldn't want it loading pages I didn't specifically request.

Glad you got it figured out, and thanks for letting us know what it was.

ShapeShifter: Interesting feature. Yeah, that's one option I would leave turned off (especially since I have very limited bandwidth and wouldn't want it loading pages I didn't specifically request.

Glad you got it figured out, and thanks for letting us know what it was.

@trippingly, glad you got it too. I'm making a note for my documentation. This will go under bugs. Thanks again Jesse