php在同一窗口中与图像打开链接

发布于 2025-01-21 18:49:27 字数 340 浏览 1 评论 0原文

我正在使用图像打开一个链接,但是我想确保链接始终在同一页面中打开,这是我的代码

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

,但有时在新页面中打开,我尝试包括target =“ _ _ self”,但不能让此工作要工作

。链接是在电子邮件中发送的,因此在某些帐户中,一个流行窗口询问用户是否要打开或保存,这是我要避免的,并直接从电子邮件中打开链接。 Gmail,但不在Hotmail中

I am opening a link with an image, but I want to ensure that 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 opens in a new page, i tried including target = "_self" but cannot get this to work

The link is sent in an email, so in some accounts, a pop window asks if the user wants to open or save, it is this I want to avoid and have the link open directly from the email which it does in gmail but not in hotmail

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如果没有你 2025-01-28 18:49:27

不幸的是,这不是您可以控制的。电子邮件中的HTML由各种电子邮件客户端解释,他们决定如何打开链接。

Outlook Web应用程序(由Hotmail使用),将target属性自动绑在锚元素上,并包括target =“ _ blank”而不是。

Unfortunately, this is not something you can control. The HTML in the email is interpreted by the various email clients and they decide how links should be opened.

The Outlook Web App (used by Hotmail), automatically strips the target attribute on anchor elements and includes target="_blank" instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文