How to mark POSTing URLs?
Search engines and pre-fetching browser plugins can cause quite some trouble with <a>
eleme开发者_高级运维nts where the destination page changes the state of the server. In a <form>
, I'd mark it as modifying with method="POST"
. Is there a similar way to mark regular links as modifying?
rel="nofollow"
does not solve the problem. From the specification:
By adding rel="nofollow" to a hyperlink, a page indicates that the destination of that hyperlink should not be afforded any additional weight or ranking by user agents which perform link analysis upon web pages (e.g. search engines)
A plain old link can only make get requests. A get request, as you indicated, should not trigger any destructive changes.
The solution, if you can't or don't want to have a form in your page at that point, is to have the link point to a page that does have a form. For instance, if you have a "delete" link it might point to a page that says "Are you sure you want to delete X? [delete]".
Then, if you don't want people to have to leave the page every time they delete something, you can implement some AJAX functionality in JavaScript.
精彩评论