Home  >  Q&A  >  body text

Open a PHP link with an image in the same window

I am opening a link with an image but I want to make sure the link always opens in the same page, here is my code

echo  "<a href=\"/mysite.com/$directory/$dir/$line\"><img src=\"/mysite.com/images/000001.png\"  /></a>";

This works fine but sometimes it opens in a new page, I tried including target = "_self" but couldn't get it to work

The link is sent via email, so in some accounts, a window will pop up asking the user if they want to open or save, which I want to avoid and open the link directly from the email, like in gmail Same as in Hotmail but there is no

in Hotmail
P粉781235689P粉781235689178 days ago321

reply all(1)I'll reply

  • P粉846294303

    P粉8462943032024-03-30 00:35:04

    Unfortunately, this is not something you can control. The HTML in emails is interpreted by various email clients and determines how to open the link.

    Outlook Web App (used by Hotmail) automatically removes the target attribute on the anchor element and contains target="_blank" instead.

    reply
    0
  • Cancelreply