作者: 肖欣怡 | 来源:发表于2018-12-19 20:44 被阅读0次

    target

    <a href = "http://qq.com" target = "_blank"></a> 在新页面中打开
    <a href = "http://qq.com" target = "_self"></a> 在自己的页面中打开
    <a href = "http://qq.com" target = "_parent"></a> 在父页面中打开
    <a href = "http://qq.com" target = "_top"></a> 在顶级页面中打开,例如iframe1打开iframe2,iframe2打开iframe3,iframe3里面有这个a链接的时候,会在包裹iframe1的那个页面中打开

    download

    <a href = "http://qq.com" target = "_blank" download></a>
    表示下载http://qq.com这个链接而不是打开,target = "_blank"不受影响,download相当于content-type:application/octet-stream

    路径合法性

    1.<a href = "http://qq.com" ></a>
    2.<a href = "//qq.com" ></a> 打开方式使用当前协议的方式打开,例如http或者https或者file://
    3.<a href = "?name=frank" ></a> 会加在链接后面
    4.<a href = "javascript::alert(1);" ></a> 相当于执行了alert(1)
    5.<a href = "javascript:;" ></a> a链接相当于没有用
    6.<a href = "#" ></a> 会刷新页面
    7.<a href = "" ></a> 会刷新页面

    相关文章

      网友评论