Typecho超链接默认新页面打开

Typecho版本 1.0 (14.10.10)文章的超链接点击之后默认会在当前页面打开,搜索了一下改默认新页面打开

\var\CommonMark\HtmlRenderer.php 的104行处,添加一段代码:$attrs['target'] = '_blank';即可。

以下是修改后的代码:

case CommonMark_Element_InlineElement::TYPE_LINK:
$attrs['href'] = $this->escape($inline->getAttribute('destination'), true);
if ($title = $inline->getAttribute('title')) {
$attrs['title'] = $this->escape($title, true);
}
$attrs['target'] = '_blank'; #添加这一行代码链接默认新窗口打开
return $this->inTags('a', $attrs, $this->renderInlines($inline->getAttribute('label')));
Licensed under CC BY-NC-SA 4.0
最后更新于 Oct 14, 2016 15:26 UTC
点击刷新🚌