Alexander Gorelik
Alexander Gorelik

Reputation: 4385

Prevent linked-in and tiwtter share to open in the same window

I use the same code(Except the height parameter) to open linked-in and twitter share windows

window.open(
        url,
        title,
        '_blank,directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,=no,width='
        + width + ', height=' + height + ', left=' + x + ',top=' + y
    );

But they are replace each other and not opened in separate windows. How do i open them in different windows.

Upvotes: 0

Views: 26

Answers (1)

nnnnnn
nnnnnn

Reputation: 150080

The second argument to the window.open() function gives a name to the window being opened. If you use the same name as an existing window then that window is re-used. You set that argument from your title variable, so make sure your title is different for your Twitter and Linked-in windows and then they'll open in separate windows.

(If you want a new window every time then set the second argument as "_blank".)

Further reading: MDN's window.open() page

Upvotes: 1

Related Questions