将html附加到< head>与JQuery [英] append html to <head> with JQuery

查看:64
本文介绍了将html附加到< head>与JQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况是,我的页面包含一个按钮和一些链接.每当用户单击按钮时,它都会尝试将标签<base>附加到<head>

My situation is that, I have page contains a button and some links. Whenever user click on the button, it tries to append tag <base> to <head>

function avoidRediect(){
    $('head').append('<base target="_blank" />');
}

但是该页面不起作用(表示该链接仍在同一窗口中打开). 我的方法正确吗? 预先感谢.

But the page does not take the effect(means the link is still opened in the same window). Is my way correct? Thank in advance.

推荐答案

实际上应该可以.

示例: http://www.jsfiddle.net/YjC6y/37/

如果删除Javascript行,它将在同一框架中打开.

If you remove the Javascript line it will open in the same frame.

您在那里使用什么浏览器?

What browser do you use there?

这篇关于将html附加到&lt; head&gt;与JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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