Retrieving profile picture of user is not working as intended

Repl link:
When trying to use profilePicture as an image source, the image does not render. Any thoughts?

Where is profilepicture defined? And why are you using document.write? You could just change the elements attributes.

Yes, I am aware about document.write.

profilePicture is defined in the head element.

Oh, sorry I am blind? Can you give us the dev-console output/more detail about your error?

It looks like it’s working for me, did you fix it? If you did you should probably say so =P


No, I have not made any changes to the code.

There is no dev console output, and I see this image when visiting the page.

This is the issue with mine too, it just says undefined. Can you paste the html code after you have logged in?
I also noticed your tag is:

  <script src=""></script>

instead of

1 Like

Changed that, didn’t seem to work. What do you mean by “paste the html code after you have logged in?”

Once you have clicked “login with replit” and logged in, just copy the pages html, otherwise the result of the write call.

I can take a screenshot of the page after logging in. Is that fine?

No, best would be the html. Just open up chrome dev tools, click the html element, Edit as html, then copy.

Here, I got it…


    body {
      background-color: lightskyblue;

    Hi, I'm Qwerty. I know Python, Lua, and a bit of JS.
    Use my Replit Ask inv pls:<br>
    <img src=""><br>


But does it work for you? If it does it is not helpful.

Yeah, it works. Also, I’ve figured out the problem. @AdvancedAPI1 doesn’t have a PFP on Replit. When you don’t have a PFP, the header just returns nothing.

1 Like

I was noticing that too, I get undefined in the src field since I have no pfp, just checked, OP does not have one either. You just got the message first.

1 Like

Interesting, thought that might be the issue earlier, but it seemed like the default profile picture counted as a profile picture.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.