Mark Stosberg <suppressed> wrote:
This morning I noticed that robots had been following "add to cart" links that I created. Oops. [...] But POSTing seems like a pain. Is there an easier way?
A sprinkle of JavaScript would do the trick nicely.
Here's an equivalent of what I do now: <a href="script.cgi?change_state=1"><img src="add.jpg"></a>
The shortest from here to there might be something like this:<img src="add.jpg" onclick="window.location='script.cgi?change_state=1'">
Still not restful, but no robot will even ~try~ to go there... and it's even *less* typing!
or, if you really love your <a>nchors, for tabbing or it's focus marquees then (tho I doubt any visitor has ever really cared) you could wrap that image up in <a href="javascript: void 0"></a> tags so it still walks like a link and talks like a link, but doesn't jump-scroll to the top when clicked.
To POST, I guess it would be like this: <!-- Some extra CSS is also need to surpress the extra space that the <form> tag adds --> <form method="POST" action="script.cgi"> <input type="hidden" name="change_state" value="1"> <input type="image" src="add.jpg"> </form>
I wonder if you could post to your query-stringy URL like this, to avoid the hidden input:
<form method="POST" action="script.cgi?change_state=1"> <input type="image" src="add.jpg"> </form>oh, and don't forget to add style="margin: 0" to that form tag so it doesn't introduce any unwanted vertical "paragraphic" whitespace, if it's a tight design.
HTH, -dave"Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats." --Howard Aitken
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.