javascript - window.open() opening same link twice -


i creating chrome extension clothing website releases items @ time. extension looks set of links contain keywords. if finds links, opens them. if not, refreshes page. accomplish using javascript , jquery. script injected via background script & tabs. here code:

if ($("body").hasclass(" products us")) {     var firstitem_link = $("a[href*='mizuno']").attr('href');     var seconditem_link = $("a[href*='schott']").attr('href');     if (firstitem_link && seconditem_link) {         window.open(firstitem_link);         window.open(seconditem_link);     } else {         window.location.reload(true);     } } 

when use code , finds links, opens them numerous times, opposed once each. how can fix this?


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -