How to open javascript items array in a new window instead of the same window? -
i have great working code opens link in same window when click it, it's inside dropdown menu.
this in javascript.
problem open in new tab instead of same window. how can this?
here code:
items["linkeee"] = { "label": "mylabel", "action": function(obj) { openurl('http://mypageaa.com/page' + addid); } };
update -- html looks this:
<a href="#">mylabel</a>
but don't have direct access html without messing stuff up. gotta there javascript
update
how combine 'http://mypageaa.com/page' + addid
add , "_blank"
please thanks
turn off pop-up blockers domain @ browser preferences or settings, see chrome pop-up blocker when re-check after allowing page. use window.open()
var w; items["linkeee"] = { "label": "mylabel", "action": function(obj) { w = window.open("http://mypageaa.com/page", "_blank"); } };
alternatively, use <a>
element @ html
target
attribute set "_blank"
<a href="http://mypageaa.com/page" target="_blank">mypageeaa</a>
using javascript
var = document.createelement("a"); a.href = "http://mypageaa.com/pagee" + addid; // `encodeuricomponent(addid)` a.target = "_blank"; document.body.appendchild(a); a.click();
Comments
Post a Comment