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


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

Re: Cherrypy - prevent browser "prefetch"?

Started byIsrael Brewster <israel@ravnalaska.net>
First post2014-12-01 13:14 -0900
Last post2014-12-01 13:14 -0900
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"? Israel Brewster <israel@ravnalaska.net> - 2014-12-01 13:14 -0900

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

FromIsrael Brewster <israel@ravnalaska.net>
Date2014-12-01 13:14 -0900
SubjectRe: Cherrypy - prevent browser "prefetch"?
Message-ID<mailman.16474.1417472090.18130.python-list@python.org>
On Dec 1, 2014, at 12:50 PM, Ned Batchelder <ned@nedbatchelder.com> wrote:

> On 12/1/14 4:26 PM, Tim Chase wrote:
>> On 2014-12-01 11:28, Israel Brewster wrote:
>>> I don't know if this is a cherrypy specific question (although it
>>> will be implemented in cherrypy for sure), or more of a general
>>> http protocol question, but when using cherrypy to serve a web app,
>>> is there anyway to prevent browser prefetch? I'm running to a
>>> problem, specifically from Safari on the Mac, where I start to type
>>> a URL, and Safari auto-fills the rest of a random URL matching what
>>> I started to type, and simultaneously sends a request for that URL
>>> to my server, occasionally causing unwanted effects.
>> 
>> All this to also say that performing non-idempotent actions on a GET
>> request is just begging for trouble. ;-)
>> 
> 
> This is the key point: your web application shouldn't be doing these kinds of actions in response to a GET request.  Make them POST requests, and Safari won't give you any trouble.
> 
> Trying to stop Safari from making the GET requests might work for Safari, but then you will find another browser, or a proxy server, or an edge-caching accelerator, etc, that makes the GET requests when you don't want them.
> 
> 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. Just feels a bit ugly to me, but if that's the Right Way™ to do it, then that's fine.

Thanks!

> 
> -- 
> Ned Batchelder, http://nedbatchelder.com
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list


-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------

[toc] | [standalone]


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


csiph-web