As stated by @Lain, just fill in the href
attribute.
<a href="http://www.la.unm.edu" style="color:red;" onclick="window.open('http://www.la.unm.edu',null,'left=50,top=50,width=700,height=500,toolbar=1,location=0,resizable=1,scrollbars=1'); return false;">Limk</a>
Working Sandbox Demo (adding this to code snippet, because code snippet doesn't allow clicking links offsite)
If you want to completely control the context menu actions, so that "Open in a New Tab" behaves identically to window.open()
, then you should probably look at this answer: How to add a custom right-click menu to a webpage?.
Why are you getting about:blank#blocked
? Well, about:blank
is just a blank page, and when you right click an element, and click something in the context menu, that does not fire the onClick
event. So, it just shows a blank page.
Why does it say #blocked
, then, too? Probably because href contains "javascript", and the browser is trying to stop malicious code from executing. There are few resources explaining this, but AskLeo.com says...
“about:blank#blocked” is sometimes displayed as the result of security software blocking access to something.
href
instead ofjavascript:;
. – Puisneabout:blank#blocked
. I had left out the closing</a>
tag. Adding this fixed the problem. – Theorbo