Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81790 > unrolled thread

Re: Cherrypy - prevent browser "prefetch"?

Started byTim Chase <python.list@tim.thechases.com>
First post2014-12-01 20:50 -0600
Last post2014-12-01 20:50 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Cherrypy - prevent browser "prefetch"? Tim Chase <python.list@tim.thechases.com> - 2014-12-01 20:50 -0600

#81790 — Re: Cherrypy - prevent browser "prefetch"?

FromTim Chase <python.list@tim.thechases.com>
Date2014-12-01 20:50 -0600
SubjectRe: Cherrypy - prevent browser "prefetch"?
Message-ID<mailman.16482.1417488456.18130.python-list@python.org>
On 2014-12-01 13:14, Israel Brewster wrote:
> On Dec 1, 2014, at 12:50 PM, Ned Batchelder <ned@nedbatchelder.com>
>> The way to indicate to a browser that it shouldn't pre-fetch a
>> URL is to make it a POST request.
> 
> Ok, that makes sense. The only difficulty I have with that answer
> is that to the best of my knowledge the only way to make a HTML
> link do a POST is to use the onclick function to run a javascript,
> while having the "link" itself point to nothing.

Well, generally one would use a form where the method=POST and then
the button/input submits it:

 <form action="/path/to/my/url/" method="POST">
  <input type="submit">This is an input<input>
 </form>

or

 <form action="/path/to/my/url/" method="POST">
  <button type="submit">This is a <strong>button</strong></button>
 </form>

The advantage of a <button> is that it can contain rich content
(other markup) while an <input type="submit"> can't.

To do a POST via an <a> tag, you do need (as you mention) to do some
ugly jiggery with JavaScript, but tends to break the mental model.
You should be able to style a <button> element to look much like a
link if you find the visual effect of a <button> unpleasant.

-tkc

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web