dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: using redirector script

  1. #1
    Join Date
    Jul 2013
    Posts
    2

    Question using redirector script

    hi im using javascript below for redirect external link using adf.ly:

    Code:
    var protected_links = "";
    var a_to_va = 0;
    var a_to_vb = 0;
    var a_to_vc = "";
    function auto_anonymize()
    {
    	auto_anonyminize();
    }
    function auto_anonyminize()
    {
    	var a_to_vd = window.location.hostname;
    	if(protected_links != "" && !protected_links.match(a_to_vd))
    	{
    		protected_links += ", " + a_to_vd;
    	}
    	else if(protected_links == "")
    	{
    		protected_links = a_to_vd;
    	}
    	var a_to_ve = "";
    	var a_to_vf = new Array();
    	var a_to_vg = 0;
    	a_to_ve = document.getElementsByTagName("a");
    	a_to_va = a_to_ve.length;
    	a_to_vf = a_to_fa();
    	a_to_vg = a_to_vf.length;
    	var a_to_vh = false;
    	var j = 0;
    	var a_to_vi = "";
    	for(var i = 0; i < a_to_va; i++)
    	{
    		a_to_vh = false;
    		j = 0;
    		while(a_to_vh == false && j < a_to_vg)
    		{
    			a_to_vi = a_to_ve[i].href;
    			if(a_to_vi.match(a_to_vf[j]) || !a_to_vi || !a_to_vi.match("http://"))
    			{
    				a_to_vh = true;
    			}
    			j++;
    		}
    		
    		if(a_to_vh == false)
    		{
    			a_to_ve[i].href = "http://adf.ly/3648604/" + a_to_vi;		
    			a_to_vb++;
    			a_to_vc += i + ":::" + a_to_ve[i].href + "\n" ;	
    		}
    	}
    	var a_to_vj = document.getElementById("anonyminized");
    	var a_to_vk = document.getElementById("found_links");
    	if(a_to_vj)
    	{
    		a_to_vj.innerHTML += a_to_vb;
    	}
    	if(a_to_vk)
    	{
    		a_to_vk.innerHTML += a_to_va;
    	}	
    }
    function a_to_fa()
    {
    	var a_to_vf = new Array();
    	protected_links = protected_links.replace(" ", "");
    	a_to_vf = protected_links.split(",");
    	return a_to_vf;
    }
    this script automatically add http://adf.ly/3648604/ to first of all external links and dont add this for internal links (including subdomains)
    now i want to add an exception for some of external links and i want this domains have direct links not redirected.

    for example now in i link to http://google.com this showed http://adf.ly/3648604/http://google.com now i want http://google.com showed http://goolgle.com and other external links showed http://adf.ly/3648604/http://example.com

    thnx.
    sorry for my poor english

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,937
    So you want to force all your internal links to redirect to a link site that pays you to share your links...
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Jul 2013
    Posts
    2
    no! I want all internal links remain direct and i want force all external links redirected except 1 link.

    for example i want all internal links and google.com remain direct
    and all external links except google.com redirected through adf.ly or other scripts

    thnx and sorry again for my poor English

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles