Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jQuery, user hits the back button, broken
Old 10-26-2010, 08:54 PM jQuery, user hits the back button, broken
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
I have a function that binds a function to all third party links within a website. It is working fine, however if someone clicks a link (which is tracked) then presses the back button in their browser and clicks another link that should be tracked, it is not tracked.

I this a known issue with document.ready?


Code:
    $(document).ready(function(){

          // sets an onclick event to call the tracking scrip
          $('a:external').bind('click',function(){ writeTracking(this.href)}, false)

          //debug, shows external links
          $('a:external').css('background-color',"yellow");

        }  // end function
      ); // end ready
Since using the back button doesn't really reload the page, and the bind's were already put into place, this one stumps me. I also have an AJAX call that could be the culprit. I just watched a tutorial on AJAX last week so I wouldn't even know where to begin if this was wrong.

Code:
    function writeTracking(linkHref){

      var url = "writeFile.cfm?writeUrl=" + linkHref;

    	if (window.XMLHttpRequest) {
    		xhr = new XMLHttpRequest();
    	}
    	else {
    		if (window.ActiveXObject) {
    			try {
    				xhr = new ActiveXObject("MSXML2.XMLHTTP.3.0");
    			}
    			catch (e) { }
    		}
    	}

    	if (xhr) {
    		xhr.open("GET", url, true);
    		xhr.send(null);
    	}
    	else {
    		alert("Error");
    	}
    	return false;

    }
The_Anomaly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-27-2010, 05:48 PM Re: jQuery, user hits the back button, broken
The_Anomaly's Avatar
Extreme Talker

Posts: 216
Location: Boston, Ma
Trades: 0
Another problem I manage to figure out on my own after I make a post... I never coded something to close the file after appending the data, so it could not write.
The_Anomaly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to jQuery, user hits the back button, broken
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.58556 seconds with 12 queries