Javascript document.location new window

2.1k views Asked by At

I am making a custom Pinterest Pin It button with Simple Icons, and I'm using the link that Pinterest Widget Builder gave me. On the default Pin It buttons, it opens this link in a completely new window. I have looked at plenty of SO questions, but all of these open it in a new tab.

I need this link to be opened in a new window, not tab.

HTML:

<div class="pinit" onclick='window.open("http://www.pinterest.com/pin/create/button/?url=http%3A%2F%2Flocalhost%3A8080%2FHowl%2FHome.html&media=http%3A%2F%2Fi.imgur.com%2FToZz7PB.png&description=Howl%3A%20Share%20Your%20Life")'><img src="http://raw.github.com/danleech/simpleicons/master/icons/pinterest/pinterest-64.png"></div>

CSS:

.pinit {
  background: #CB2027;
  width: 65px;
  border-radius: 10px;
  cursor: pointer;
}
.pinit:hover {
  background: #e41f11
}

JavaScript:

For the JS, I used the Pinterest link: <script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>

1

There are 1 answers

5
StaleMartyr On BEST ANSWER

try this one

<div class="pinit" onclick='window.open("http://www.pinterest.com/pin/create/button/?url=http%3A%2F%2Flocalhost%3A8080%2FHowl%2FHome.html&media=http%3A%2F%2Fi.imgur.com%2FToZz7PB.png&description=Howl%3A%20Share%20Your%20Life","Pin It","width=300,height=300,top=0,left100")'>

provide name and properties to your new window.

,"Pin It","width=300,height=300,top=0,left100"