Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

window.open(url) called onclick opens in 2 new windows instead of 1 window. This piece of code works fine in other browsers

window.open(url) called onclick opens in 2 new windows instead of 1 window. This piece of code works fine in other browsers. Is there any other specific code to be used in jquery script for opening in one tab?

Posted on Oct 7, 2015 5:20 AM

Reply
1 reply

Oct 7, 2015 5:49 AM in response to yellinas

Code used in jsp:


<li class="gallery">Gallery</li>


Code used in external js:


$('.gallery').on('click', function() {

if (!window.location.origin) {

window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');

}

var newUrl = window.location.origin;

window.open(newUrl+'/gallery');

return false;

});


Help Needed: Please Let me know if there is an alternative solution.

My requirement is to open the base url appended with gallery in a new tab.

window.open(url) called onclick opens in 2 new windows instead of 1 window. This piece of code works fine in other browsers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.