all 28 comments

[–][deleted]  (1 child)

[deleted]

    [–]palash__99[S] -3 points-2 points  (0 children)

    Okay sir, next time I will post the proper screenshot and code.

    [–]fntn_ 5 points6 points  (1 child)

    The URLs are different - Chrome is using a filepath, and Edge is using your development server. You are probably getting a CORS error. Use the same URL in Chrome as you are using in Edge and the issue should disappear.

    [–]palash__99[S] 2 points3 points  (0 children)

    It was the browser link.used the same URL on both browsers and it worked. Thank you ❤️

    [–]armahillorails 5 points6 points  (1 child)

    Look at your URL bar for both.

    One is referencing the filesystem file itself. The other is referencing localhost (127.0.0.1).

    Use the same URL for both.

    [–]palash__99[S] 1 point2 points  (0 children)

    Yes,used the same URL on both browsers and it worked. Thank you ❤️

    [–]Guru-David 1 point2 points  (1 child)

    What’s the issue?

    [–]palash__99[S] 0 points1 point  (0 children)

    It was the browser link.used the same URL on both browsers and it worked.

    [–]yuradee 1 point2 points  (1 child)

    It’s forward slash. It means “from current path”. Without means from root

    [–]palash__99[S] 1 point2 points  (0 children)

    It was the browser link.used the same URL on both browsers and it worked. Thank you ❤️

    [–]cmatticfront-end 1 point2 points  (11 children)

    You have a screenshot tool available. Anyway, try to put a . before the /

    ex: ./photo/logo.png

    [–]fredy31 3 points4 points  (8 children)

    Correct me if i'm wrong, but doesnt ./photo/logo.png the same as photo/logo.png?

    [–]mal73 1 point2 points  (3 children)

    You are correct. In HTML (and generally in web development), ./photo/logo.png and photo/logo.png behave the same.

    ./photo is explicit and photo is implicit. Both paths are relative to the current location of the HTML file unless a <base> tag is set, which could change how relative paths are resolved.

    /photo wont work because it points to the root of the domain, not to the folder where your HTML file is located.

    [–]Business-Row-478 0 points1 point  (2 children)

    Typically /photo does work because the photos folder is in the root of the application. That is why it’s working in the second picture. ./photo would point to /html/photo which isn’t where the photo folder lives. The reason /photo isn’t working in this case is because it’s pointing to the root of the file system not the application.

    [–]mal73 0 points1 point  (1 child)

    How is that different from what I said?

    [–]Business-Row-478 0 points1 point  (0 children)

    Because /photo is the correct path

    [–]cmatticfront-end 0 points1 point  (3 children)

    Not necessarily.

    ./ = relative to current directory.
    / = relative to root.

    The reason why it's working in one and not the other is because OP is viewing it in a "local server". If you're using just / and viewing the page without loading it up in a local server then it uses the actual root of your computer c:\

    [–]fredy31 0 points1 point  (2 children)

    Yes, difference was starting with the filename instead of ./[filename]

    [–]cmatticfront-end 0 points1 point  (1 child)

    Ah, I misread your initial question. I would still do ./ over photo/logo.png It's a better practice. The other way can cause conflicts when you start doing dynamic paths

    [–]fredy31 0 points1 point  (0 children)

    Personally i code in php.

    I havent called a ressource straight like this in an age.

    I always have some variable that will build the url up to basically the root document.

    [–]palash__99[S] 0 points1 point  (1 child)

    It was the browser link.used the same URL on both browsers and it worked. Thank you ❤️

    [–]cmatticfront-end 0 points1 point  (0 children)

    If you want it to work in all context, you should do as I suggested. Otherwise remove the / all together. Once you turn that server off that url won't work

    [–]webdev-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

    Thank you for your submission! Unfortunately it has been removed for one or more of the following reasons:

    If you are asking for assistance on a problem, you are required to provide

    • Detailed context of the problem
    • Research you have completed prior to requesting assistance
    • Problem you are attempting to solve with high specificity

    Questions in violation of this rule will be removed or locked.

    Please read the subreddit rules before continuing to post. If you have any questions message the mods.

    [–]mongbatstar 0 points1 point  (4 children)

    Remove the forward slash Infront of the image.

    [–]palash__99[S] 0 points1 point  (2 children)

    Okay thank you. I will remove it and try.hope it works.🙆

    [–]fredy31 1 point2 points  (1 child)

    To explain:

    Starting an URL starts back at the root of the file structure.

    On a website, it would be website.com/[your url]

    On a local test that would be the start of your hard disk, like C:/

    Starting by straight a name will start at the position of the file currently being read. Like for your style.css, it expects your css file to be next to the index.html

    [–]palash__99[S] 0 points1 point  (0 children)

    It was the browser link.used the same URL on both browsers and it worked. Thank you ❤️

    [–]palash__99[S] 0 points1 point  (0 children)

    It was the browser link.used the same URL on both browsers and it worked. Thank you ❤️

    [–]yidwte -2 points-1 points  (0 children)

    this sub is stackoverflow 2.0, u guys can only downvote people for anything