+ Start a Discussion
Nertin HoxhaNertin Hoxha 

Firefox problem with javascript button

Hello Everybody, i need some assistance please.
When using Firefox , an One click javascript button doesn't work so i can see non pop up or new tab with the content.
It works pretty fine on chrome , instead. Is it an workaround available.
How can adapt this code , in case. Thanks
var a= document.createElement('a');

a.href = '/apex/3eShow?fatturaId={!Fattura__c.IdFattura__c}';

a.setAttribute('target', '_blank');

a.click();

/*
setTimeout(function(){

window.location.reload(true);

},5000);
*/

 
Best Answer chosen by Nertin Hoxha
Nayana KNayana K
var a= document.createElement('a');

a.href = '/apex/3eShow?fatturaId={!Fattura__c.IdFattura__c}';

a.setAttribute('target', '_blank');
//you can explicitly add the created element to the DOM and it will work
document.body.appendChild(a);
a.click();

 

All Answers

Nayana KNayana K
var a= document.createElement('a');

a.href = '/apex/3eShow?fatturaId={!Fattura__c.IdFattura__c}';

a.setAttribute('target', '_blank');
//you can explicitly add the created element to the DOM and it will work
document.body.appendChild(a);
a.click();

 
This was selected as the best answer
Nertin HoxhaNertin Hoxha
let me tell you smth , Nayana: You're the best! Thanks
Nayana KNayana K
:) Welcome Nertin.