I am trying to run a little JavaScript code. I need to update the data on the page (using a specific link), then I want to load this page with the updated data.
I need to open the link before opening the page in order to update the data due to the platform that I use.
I quickly wrote JavaScript and tested it. It works fine in Internet Explorer and Google Chrome, but for some reason it seems like it doesn't start the while loop in Firefox. I am not sure why it does not work when I was looking for syntax, and it seems correct.
var refreshed = false;
while (refreshed != true) {
refreshpage = window.open('https://na10.salesforce.com/dash/dashboardRefresh');
refreshed = true;
refreshpage.close();
}
window.open('/dashboard', '__tab');
I tried to use the timeout function to close the window. But I'm not sure if I am using this correctly. It will do everything, including in a loop, but never closes the window.
Here's the updated code:
var refreshed = false;
var timeOut = setTimeout(function() {
refreshpage.close();
}, 1000);
while (refreshed != true) {
refreshpage = window.open('https://na10.salesforce.com/dash/dashboardRefresh');
refreshed = true;
clearTimeout(timeOut);
}
window.open('/dashboard', '__tab');