Link to image file

Discussion in 'HTML & Website Design' started by fotoviva, Feb 24, 2011.

  1. #1
    I thought this was easy but it seems not. I want to create a link that opens an image in a new window. It links directly to the image like this:

    <a href="images/globe.jpg">open image in new window</a>

    This works fine in Safari but not FF or IE !!!
    Is Safari more intelligent and can show the picture? IE just shows a red cross.
     
    fotoviva, Feb 24, 2011 IP
  2. gizmo101.net

    gizmo101.net Member

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Simple fix, just put target=_new or target=_blank after the url. Example

    <a href="images/globe.jpg" target=_blank>open image in new window</a>

    I'm not completely sure of all the differences in target=_new and target=_blank, but when you enter _new it opens the image in a new tab (in mozilla, haven't tried IE) and _blank opens a new window
     
    gizmo101.net, Feb 24, 2011 IP
  3. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #3
    No it still shows the red X in IE. As a correction, it does work in FF so it seems IE is the culprit.
     
    fotoviva, Feb 24, 2011 IP
  4. gizmo101.net

    gizmo101.net Member

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Did you try putting the whole link to the image?
     
    gizmo101.net, Feb 24, 2011 IP
  5. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Interesting...I put the full url path in ie. http://mysite987.com/images/globe.jpg and it looked like it was loading the image (file is 130k) but then just displayed the red cross!
     
    fotoviva, Feb 24, 2011 IP
  6. karthimx

    karthimx Prominent Member

    Messages:
    4,959
    Likes Received:
    127
    Best Answers:
    2
    Trophy Points:
    340
    #6
    the problem is on the path that you mentioned.

    <a href="../images/globe.jpg" target="_blank">Text</a>
     
    karthimx, Feb 25, 2011 IP
  7. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Sorry I was just simplifying the code for the forum, it was coded correctly. Perhaps someone could try this their end and check to see if the image opens in IE?

    Would really appreciate it :)


     
    fotoviva, Feb 25, 2011 IP
  8. Bapinder

    Bapinder Well-Known Member

    Messages:
    151
    Likes Received:
    7
    Best Answers:
    3
    Trophy Points:
    120
    #8
    Bapinder, Feb 25, 2011 IP
  9. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #9
    Thanks, but it's not so much the 'new window' aspect but that I can't get the image to open from a link :(
     
    fotoviva, Feb 25, 2011 IP
  10. asepsjmak

    asepsjmak Well-Known Member

    Messages:
    2,397
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    130
    #10
    <a href="images/globe.jpg" target="_new">New Window</a>
    <a href="images/globe.jpg" target="_blank">New Tab</a>
    <a href="images/globe.jpg" target="_blank" title="SEO Friendly">SEO Friendly</a>

    it's good for SEO i think
     
    asepsjmak, Feb 25, 2011 IP
  11. gift4usa

    gift4usa Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    <a href="ges/globe.jpg" target="_blank">New Tab</a>
     
    gift4usa, Feb 25, 2011 IP
  12. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #12
    Thankfully I have now fixed the problem. The jpg file was cmyk instead of rgb! Schoolboy error on my part but funny how Safari and FF has the brains to render it but crappy IE doesn't!
     
    fotoviva, Feb 25, 2011 IP
  13. gizmo101.net

    gizmo101.net Member

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #13
    Glad you figured it out. I've also had a lot of trouble with IE when I do certain coding to my website.
     
    gizmo101.net, Feb 25, 2011 IP