I have a page with button to perform print action. Here in this case , on click of the button, I want to open a new tab with a modification in the url without reloading the page.
Here is the code that I am calling on click of the button.
function changeUrl(){
var printurl = 'https://www.example.com/mytest/print/1022/United-Arab-Emirates/2018/Guide-on-VAT-treatment-of-insurance-issued?lang=en&dir=ltr'
var path = '1022/United-Arab-Emirates/2018/Guide-on-VAT-treatment-of-insurance-issued'
var b = url.substring(0,url.indexOf('mytest'));
var newurl = b +'print/' + articlepath + '?lang=en&dir=ltr';
window.open(printurl,"_blank");
history.pushState(null,null,newurl);
}
Can anyone help me here to fix this issue?