Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:40:28+00:00 2026-06-14T21:40:28+00:00

I am trying to get h=Af?????????? value from reporting link at social networking site.

  • 0

I am trying to get h=Af?????????? value from reporting link at social networking site. I test with this : http://jsfiddle.net/rtnNd/6/ to retrieve the value, it works when I tested out.

but I don’t want user to interact with it. the script have to auto retrieve the the page and get the value of it. ( I test with Google Chrome Javascript Console) when I try with following coding which does scrabble the page and assign to value d and find the value of h, but search/replace doesn’t work at all. Why getElementsByClassName is not working in that?

With JQuery:

function getParameterByName(name, path) {
        var match = RegExp('[?&]' + name + '=([^&]*)').exec(path);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}

var URL = 'http://www.facebook.com/zuck';
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", URL, true);
xmlhttp.setRequestHeader("Content-type", "application/xhtml+xml");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
       if (xmlhttp.status == 404) {
               result = error404;
       }
       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
              var d = xmlhttp.responseText;
               var jayQuery = document.createElement('script');
               jayQuery.src = "//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
               document.getElementsByTagName("head")[0].appendChild(jayQuery);
               var href = $($('.hidden_elem').d.replace('<!--', '').replace('-->', '')).find('.itemAnchor[href*="h="]').attr('href');
               var fbhvalue = getParameterByName('h', href);
               alert(fbhvalue);
       }
}

I go this error, “ERROR: Uncaught TypeError: Cannot call method ‘replace’ of undefined”, Even I add the jquery.

Without JQuery:

      function getParameterByName(name, path) {
        var match = RegExp('[?&]' + name + '=([^&]*)').exec(path);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var URL = 'http://www.facebook.com/zuck';
xmlhttp = new XMLHttpRequest();

xmlhttp.open("GET", URL, true);
xmlhttp.setRequestHeader("Content-type", "application/xhtml+xml");
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
        if (xmlhttp.status == 404) {
                // result = error404;
        }
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                d = xmlhttp.responseText;
                checker(d);
        }
}

function checker(i) {
        i.value = i;

        var hiddenElHtml = i.replace('<!--', '').replace('-->', '').find('.itemAnchor[href*="h="]').attr('href');

        var divObj = document.createElement('div');
        divObj.innerHTML = hiddenElHtml;

        var itemAnchor = divObj.getElementsByClassName('itemAnchor')[0];
        var href = itemAnchor.getAttribute('href');
        var fbId = getParameterByName('h', href);
        alert(fbId);

}

When I run it, I got the error called “object has no method ‘find'”.

Why getElementsByClassName, getParameterByName, Jquery, getAttribute are not working after xmlhttp.onreadystatechange statement called? please can you point me out. Is there any way to find out how to get value? Thanks for reading my question and answering!

Updated:
( If i visited on profile page, run following script in javascript console of Google Chrome, it gots the h value – but I really don’t want that way… I want to specified the user profile name, it has to retrieve automatically and get the h value of it.)

    var jayQuery = document.createElement('script');
    jayQuery.src = "//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
    document.getElementsByTagName("head")[0].appendChild(jayQuery);

    function getParameterByName(name, path) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(path);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }


    var href = $($('.hidden_elem')[1].innerHTML.replace('<!--', '').replace('-->', '')).find('.itemAnchor[href*="h="]').attr('href');
    alert(href);
    var fbId = getParameterByName('h', href);
    alert(fbId);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:40:30+00:00Added an answer on June 14, 2026 at 9:40 pm

    If you use this script outside the facebook you will definitely get SOP, It is limited due to security reasons see this: Access Control Allow Origin not allowed by

    So, Let’s imagine you got the response string xmlhttp.responseText, so you cannot use some JQuery or JavaScript functions which only work with DOM objects but it is just plain string. For example, you used find(), attr(), methods which don’t work with strings. You can play with it as a string and nothing more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get value from Excel cells in this way: SpreadsheetDocument spreadSheetDocument =
I am trying to get value from passwordbox for developing a simple login functionality,
While i am trying to get value from arraylist,i got the following errors.My sample
I'm trying to get a value from an HTML page that has the name
i am trying to get the value from my methods and display it in
I'm trying to get the KeyField value from the FocusedRow in devexpress aspxGridview. Following
I have been trying to get a custom Value from the Custom Field that
I'm trying to get a long value from a String containing a Facebook ID,
I'm trying to get the onreadystate value from the browser control do detect when
I'm trying to get a specific value from a mysql_fletch_assoc array. I explain. Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.