Answer the question
In order to leave comments, you need to log in
How to click on a button to open a page in a new tab in firefox?
It is necessary that after the successful completion of the request, a new tab is opened
<button type="button" id="planned" @click="acceptRoute(routeInfo.id)">Спланировать путешествие</button>
acceptRoute(id) {
var apiUrl = '/routes/';
return http.put(apiUrl + id + '/accept/').then((response) => {
if (response.status == 200) {
window.open(document.location.origin + '/plan/country/', '_blank')
}
})
},
window.open(document.location.origin + '/plan/country/', '_blank')
called in firefox popup blocker. If you do it like thisacceptRoute(id) {
var apiUrl = '/routes/';
return http.put(apiUrl + id + '/accept/').then((response) => {
if (response.status == 200) {
document.querySelector('.planned').onclick = () => {
window.open(document.location.origin + '/plan/country/', '_blank');
}
}
})
},
Answer the question
In order to leave comments, you need to log in
There is a stupid option to do everything through the w ... form. But it all seems very strange.
function openUrlInTab(url) {
let form = document.createElement('form');
form.target = '_blank';
form.action = url;
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question