Client side href lost, can I send it back on postback?
I'm losing client side href. Is it possible to send it ba开发者_如何学JAVAck to the server on the button submit using a variable or something?
Yes. You could use a hidden form input, added on either the server or client side:
<input type="hidden" name="referring_url" value="http://...">
To automatically add the current URL using JavaScript:
<form onsubmit="addHref(this)" ...
function addHref(form) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'referring_url';
input.value = window.location.href;
form.appendChild(input);
}
精彩评论