I'm trying to catch the clicks on the links through out my site. I'm using XMLHttpRequest to save those clicks in database.
function GetXmlHttpObject() {
var objXMLHttp = null
if (window.XMLHttpRequest) {
objXMLHttp = new XMLHttpRequest()
}
else if (window.ActiveXObject) {
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function SubmitRequest(HighlightID) {
var url = "Redirect.aspx?MediaHighlightID=" + HighlightID;
xmlSaveItemHttp = GetXmlHttpObject();
if (xmlSaveItemHttp == null) {
return
}
// xmlSaveItemHttp.onreadystatechange = ChangeItemStatus
xmlSaveItemHttp.open("GET", url, true)
xmlSaveItemHttp.send(null)
}
The clicks get saved in all browsers except IE. In IE alternate clicks are getting saved. i.e. if I click on a link thrice then first and third clicks are saved but not the second one.
You may watch HTTP requests, for example by fiddler, see if all the three requests are sent in IE. Some times if you click fast, not every click will be captured by IE.
swarup
Member
17 Points
21 Posts
XMLHttpRequest()
Feb 10, 2012 10:56 AM|LINK
Hi,
I'm trying to catch the clicks on the links through out my site. I'm using XMLHttpRequest to save those clicks in database.
function GetXmlHttpObject() {
var objXMLHttp = null
if (window.XMLHttpRequest) {
objXMLHttp = new XMLHttpRequest()
}
else if (window.ActiveXObject) {
objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
function SubmitRequest(HighlightID) {
var url = "Redirect.aspx?MediaHighlightID=" + HighlightID;
xmlSaveItemHttp = GetXmlHttpObject();
if (xmlSaveItemHttp == null) {
return
}
// xmlSaveItemHttp.onreadystatechange = ChangeItemStatus
xmlSaveItemHttp.open("GET", url, true)
xmlSaveItemHttp.send(null)
}
<a href='<%#Convert.ToString(DataBinder.Eval(Container.DataItem, "ArticleURL"))%>' onclick="javascript:SubmitRequest(<%#Convert.ToString(DataBinder.Eval(Container.DataItem, "MediaHighlightID"))%>);" style="color:#333333" target="_blank"><%#Convert.ToString(DataBinder.Eval(Container.DataItem, "ArticleTitle"))%></a>
The clicks get saved in all browsers except IE. In IE alternate clicks are getting saved. i.e. if I click on a link thrice then first and third clicks are saved but not the second one.
Any suggestions or help is appreciated.
Regards
Swarup
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: XMLHttpRequest()
Feb 13, 2012 03:10 AM|LINK
Hello
You may watch HTTP requests, for example by fiddler, see if all the three requests are sent in IE. Some times if you click fast, not every click will be captured by IE.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
chetan.sarod...
All-Star
65619 Points
11118 Posts
Re: XMLHttpRequest()
Feb 14, 2012 02:32 AM|LINK
http://msdn.microsoft.com/en-us/library/ms535874(v=vs.85).aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.