|
Generally it is not a good practice to have a link which modifies something (delete, unpublish etc.) as there are various issues (search engines, users copying and pasting links, cross site scripting etc.).
For this reason it looks like the link is not actually being invoked when you click the link.
If you look at the network tab in Chrome developer tools you'll see that it's actually doing a post to that URL and including the __RequestVerificationToken form field.
Here's the code in /Core/Shapes/Scripts/base.js that is overriding the click event on links that have the
itemprop attribute set to "UnsafeUrl":
// UnsafeUrl links -> form POST
//todo: need some real microdata support eventually (incl. revisiting usage of data-* attributes)
$(function () {
var magicToken = $("input[name=__RequestVerificationToken]").first();
if (!magicToken) { return; } // no sense in continuing if form POSTS will fail
$("a[itemprop~=UnsafeUrl]").each(function () {
var _this = $(this);
var hrefParts = _this.attr("href").split("?");
var form = $("<form action=\"" + hrefParts[0] + "\" method=\"POST\" />");
form.append(magicToken.clone());
if (hrefParts.length > 1) {
var queryParts = hrefParts[1].split("&");
for (var i = 0; i < queryParts.length; i++) {
var queryPartKVP = queryParts[i].split("=");
//trusting hrefs in the page here
form.append($("<input type=\"hidden\" name=\"" + decodeURIComponent(queryPartKVP[0]) + "\" value=\"" + decodeURIComponent(queryPartKVP[1]) + "\" />"));
}
}
form.css({ "position": "absolute", "left": "-9999em" });
$("body").append(form);
_this.click(function () {
if (_this.filter("[itemprop~='RemoveUrl']").length == 1) {
if (!confirm(confirmRemoveMessage)) {
return false;
}
}
form.submit();
return false;
});
});
});
|