Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
"This" not returning asked value

Im a beginner in Javascript, and I have the following problem ... can someone tell me what I'm doing wrong ? Thanks !

So, go on Instagram, fill the following code in the console:

var open = window.XMLHttpRequest.prototype.open,
    onReadyStateChange;

function openReplacement(method, url, async, user, password) {
    if (url.match(/https:\/\/i\.instagram\.com\/api\/v1\/feed\/user\/[0-9]{1,16}\/story\//g)) {
        console.log(url)
        console.log(this)
        console.log(this.response)
    }
    return open.apply(this, arguments);
}

window.XMLHttpRequest.prototype.open = openReplacement;

So, when I do this and go on a profile, it is supposed to read and print the api response to the get the story data, and it prints the following thing for the console.log(this):

XMLHttpRequest:
    listeners: {load: Array, error: Array, timeout: Array}
    onabort: null
    onerror: function(t)
    onload: function()
    onloadend: null
    onloadstart: null
    onprogress: null
    onreadystatechange: null
    ontimeout: function()
    readyState: 4
    response: "{\"broadcast\":null,\"reel\":{\"id\":…"
    responseText: "{\"broadcast\":null,\"reel\":{\"id\":…"
    responseType: ""
    responseURL: "https://i.instagram.com/api/v1/feed/user/AN_ID/story/"
    responseXML: null
    status: 200
    statusText: ""
    timeout: 10000
    upload: XMLHttpRequestUpload {onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, …}
    withCredentials: true

But when the following line comes console.log(this.response), an empty line is printed. And it does this with every values printed in the this upper. I tried to console.log(Object.keys(this)), but same, an empty line is printed ...

If I do this.test = "test there" and do console.log(this.test), "test there" is well printed.

What am I doing wrong ??? Why isn't it returning me the response value from the this ? Thanks for your help !

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda