1

Is it possible to get the source code of javascript used in a web page. I want the source of javascript with actual variables but not with values replacing the variables.

function fun() {
 var x = '12938771293737123791738';

document.location   = x;
}

Here in the above script, x value has been replaced by value "12938771293737123791738". I want to see the java script source code without x value getting replaced. Can we get it.

3
  • Huhhh? x has no value before it is declared and assigned ` "12938771293737123791738"`. What are you really trying to do? Commented Aug 3, 2012 at 4:42
  • 1
    Depends on how it is being served. If the substitution happens server-side, you can (probably) only get the original source if you can gain login access to the server. Why do you think it's being substituted? Commented Aug 3, 2012 at 4:44
  • i have this javascript in a web page, i want to know from where the value of x is coming. Before x getting actual value, it should be assigned to some 'y' right. Can i see to which variable the x is assigned to. I'm very sure that 'x' value is not constant and it is dynamic. Commented Aug 3, 2012 at 4:45

1 Answer 1

2

If the javascript is being added dynamically to the page then you will not be able to get anything but what you see from the response without access to the local source code.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you ChrisBint, I have another question, can we access the javascript variable x in above function by injecting another javascript function. I'm trying to make recruiter job easier, on click of button i want all the details of candidate available to recruiter. To achieve this i want to get the value of x variable somehow. is it possible.?
@Maddy Possibly with a regex looking for the whole 'var x = ??' string and then extracting the value accordingly.
Thank you ChrisBint once again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.