Create a gist now

Instantly share code, notes, and snippets.

console.log('Location:', '' + window.location);
console.log('Number of links:', document.querySelectorAll('a').length);
console.log('Number of _blank links:', document.querySelectorAll('a[target="_blank"]').length);
console.log('% of _blank links:', ~~( document.querySelectorAll('a[target="_blank"]').length / document.querySelectorAll('a').length * 100 ) );
// changed .log() to .dir() for twitter
/* Tested on 2014-04-14
Location: https://www.google.co.za/
Number of links: 45
Number of _blank links: 1
% of _blank links: 2
ocation: https://www.google.co.za/#q=_blank+anchor
Number of links: 115
Number of _blank links: 1
% of _blank links: 0
Location: http://www.bing.com/
Number of links: 19
Number of _blank links: 1
% of _blank links: 5
Location: http://www.bing.com/search?q=_blank+anchor&go=&qs=ds&form=QBLH&filt=all
Number of links: 49
Number of _blank links: 1
% of _blank links: 2
Location: https://za.yahoo.com/?p=us
Number of links: 194
Number of _blank links: 4
% of _blank links: 2
Location: https://search.yahoo.com/search;_ylt=Aia1dj069eyey77mbQjy0mroQeF_?p=_blank+anchor&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-915
Number of links: 106
Number of _blank links: 38
% of _blank links: 35
Location: http://www.baidu.com/
Number of links: 45
Number of _blank links: 5
% of _blank links: 11
Location: http://www.baidu.com/#wd=_blank%20anchor&rsv_bp=0&tn=baidu&rsv_spt=3&ie=utf-8&rsv_sug3=9&rsv_sug4=1015&rsv_sug1=1&rsv_sug2=0&inputT=31737
Number of links: 162
Number of _blank links: 89
% of _blank links: 54
Location: http://www.youtube.com/
Number of links: 178
Number of _blank links: 0
% of _blank links: 0
Location: http://www.reddit.com/
Number of links: 417
Number of _blank links: 11
% of _blank links: 2
Location: https://www.facebook.com/
Number of links: 757
Number of _blank links: 35
% of _blank links: 4
Location: https://www.facebook.com/~~~~~~~~~~~~~~~?sk=info&edit=eduwork
Number of links: 288
Number of _blank links: 16
% of _blank links: 5
Location: https://twitter.com/
Number of links:348
Number of _blank links:34
% of _blank links:9
Location: http://www.wikipedia.org/
Number of links: 313
Number of _blank links: 0
% of _blank links: 0
Location: http://en.wikipedia.org/wiki/Special:Search?search=_blank+anchor&go=Go
Number of links: 110
Number of _blank links: 0
% of _blank links: 0
Location: http://www.qq.com/
Number of links: 1157
Number of _blank links: 1090
% of _blank links: 94
Location: http://www.sogou.com/
Number of links: 23
Number of _blank links: 6
% of _blank links: 26
Location: http://www.sogou.com/sogou?pid=sogou-wsse-3f7bcd0b3ea82268&ie=utf-8&query=_blank%20anchor
Number of links: 104
Number of _blank links: 40
% of _blank links: 38
Location: http://www.sina.com.cn/
Number of links: 1671
Number of _blank links: 1460
% of _blank links: 87
Location: https://www.linkedin.com/
Number of links: 81
Number of _blank links: 8
% of _blank links: 9
Location: http://www.taobao.com/market/global/index_new.php
Number of links: 193
Number of _blank links: 71
% of _blank links: 36
Location: http://pda.104.com.tw/
Number of links: 141
Number of _blank links: 61
% of _blank links: 43
Location: https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&ct=1397496505&rver=…2Fmail.live.com%2Fdefault.aspx&lc=7177&id=64855&mkt=en-za&cbcxt=mai&snsc=1
Number of links: 9
Number of _blank links: 1
% of _blank links: 11
Location: http://weibo.com/
Number of links: 43
Number of _blank links: 27
% of _blank links: 62
Location: http://www.163.com/
Number of links: 2161
Number of _blank links: 419
% of _blank links: 19
Location: http://wordpress.com/
Number of links: 15
Number of _blank links: 0
% of _blank links: 0
Location: http://sg.search.yahoo.com/
Number of links: 6
Number of _blank links: 0
% of _blank links: 0
Location: https://tw.yahoo.com/
Number of links: 336
Number of _blank links: 143
% of _blank links: 42
Location: https://uk.yahoo.com/
Number of links: 172
Number of _blank links: 4
% of _blank links: 2
Location: https://za.yahoo.com/?p=us
Number of links: 160
Number of _blank links: 4
% of _blank links: 2
Location: http://www.yahoo.co.jp/
Number of links: 296
Number of _blank links: 0
% of _blank links: 0
Location: https://www.google.co.jp/#q=_blank+anchor
Number of links: 113
Number of _blank links: 1
% of _blank links: 0
ocation: https://www.google.com.tw/#q=_blank+anchor
Number of links: 102
Number of _blank links: 1
% of _blank links: 0
Location: https://www.google.com.hk/#q=_blank+anchor
Number of links: 107
Number of _blank links: 1
% of _blank links: 0
Location: http://www.bing.com/?mkt=zh-CN
Number of links: 234
Number of _blank links: 179
% of _blank links: 76
Location: http://www.bing.com/search?q=_blank+anchor&go=&qs=n&form=QBLH&pq=_blank+anchor&sc=8-6&sp=-1&sk=
Number of links: 75
Number of _blank links: 23
% of _blank links: 30
Location: http://pages.ebay.com/rtm_default/980/19513.html
Number of links: 0
Number of _blank links: 0
% of _blank links: 0
Location: http://www.ebay.com.tw/
Number of links: 139
Number of _blank links: 24
% of _blank links: 17
Location: http://www.ebay.com.sg/
Number of links: 470
Number of _blank links: 66
% of _blank links: 14
Location: http://www.ebay.in/
Number of links: 492
Number of _blank links: 69
% of _blank links: 14
Location: http://www.ebay.co.jp/
Number of links: 87
Number of _blank links: 43
% of _blank links: 49
Location: http://www.ebay.fr/
Number of links: 447
Number of _blank links: 63
% of _blank links: 14
Location: http://www.ebay.co.uk/
Number of links: 408
Number of _blank links: 32
% of _blank links: 7
Location: http://www.ebay.cn/
Number of links: 213
Number of _blank links: 82
% of _blank links: 38
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment