Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81790
| Date | 2014-12-01 20:50 -0600 |
|---|---|
| From | Tim Chase <python.list@tim.thechases.com> |
| Subject | Re: Cherrypy - prevent browser "prefetch"? |
| References | <6B74D6DD-A597-4BCF-8586-D0A56C9CDB77@ravnalaska.net> <20141201152608.09ca6f13@bigbox.christie.dr> <m5inqh$kdt$1@ger.gmane.org> <60102F31-5184-4FFF-B99E-23A5B0313399@ravnalaska.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16482.1417488456.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Cherrypy - prevent browser "prefetch"? Tim Chase <python.list@tim.thechases.com> - 2014-12-01 20:50 -0600
csiph-web