使用 html 在同一选项卡中打开链接 [英] Opening a link in the same tab with html

查看:33
本文介绍了使用 html 在同一选项卡中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在点击一个词时在同一个标​​签页中打开一个带有 html 的链接.尽管如此,即使我已经尝试使用 target="_self" 而没有使用任何目标,它也只能与 target="_blank" 一起使用,但是,正如您可能知道,这会在另一个选项卡中打开链接.

I want to open a link in the same tab with html when clicking a word. Nevertheless, even if I've tried it using target="_self" and not using any target, it only works with target="_blank", but, as you may know, this opens the link in another tab.

代码:

    <!DOCTYPE html>
<html>
<head>
<style type="text/css">
body
{
  min-width:360px;
}
a{
   color:#009900;
   text-decoration:none;
}
a:hover
{
  text-decoration:underline;
}
p
{
  font:0.8em sans-serif;
}
h1
{
  font:1.5em sans-serif;
  color:#fff;
  background:#006600;
  padding:5px
}
</style>
</head>

<body>
  <h1>play</h1>
 <p><a href="https://www.youtube.com" target="_blank">YT player</a></p>
</body>
</html>

推荐答案

<a target="_self" href="https://www.youtube.com" >YT player</a>

使用_self

<a target="_self" href="https://www.youtube.com" >YT player</a>

这篇关于使用 html 在同一选项卡中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆