I use cookies to remember every page visitor visit. I would like to know how to make it use my own inserted url and title plus to avoid repeated storing of same url(Same display job page will have different url-searchid but all in same format: http://xxx.com/display-job/jobIDHere/)

My url page is like: http://xxx.com/display-job/1/Credit-...9383.44&page=1 but I only need to store link like: /display-job/1/,/display-job/113/,/display-job/214/ and so on.

My title is something like: Credit-Analyst, Accountant, engineer and so on. Use my inserted title value.

Here is the cookies script: jsfiddle

function RecordCurrentPage() {
var link = document.URL;
var title = document.title.length > 1 ? document.title : 'Untitled';
CurrentPage = '<'+'p>'+title+'<'+'/'+'p>';
var temparray = link.split('&');
link = temparray.join('~amp;');
var temparray = title.split('&');
title = temparray.join('~amp;');