0

I execute the following code from Google Chrome devTools console.

var members = $("div.members").scope().members;
members.forEach(
function(member){ 
    var url = "https://www.xdxomain.com/" + member + "/Home/";
    window.location.replace(url);
    // execute some functions   
});

after executing window.location.replace(url); the code in the console is empty. That is, there is no code to execute. Are there any hints how to get around that problem?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
Ayoub Falah
  • 484
  • 3
  • 19
  • Yep, go to the console settings (little cogwheel on the right) then check "Preserve log". So the console won't be cleared after each reload. – Jeremy Thille Nov 04 '20 at 10:40
  • 1
    @JeremyThille That will keep the logged data, but I would be surprised if it continues execution of JS. I think they're trying to use the console almost like an automated test. – DBS Nov 04 '20 at 10:42
  • @JeremyThille I double checked the option. It preserves the code but the execution isn´t continued. – Ayoub Falah Nov 04 '20 at 10:53
  • 2
    Also there will be nothing executed after a location.replace - it works almost like a return statement. Your code will redirect the FIRST member and terminate – mplungjan Nov 04 '20 at 10:53
  • Ah, you want to continue the _execution_ after page reload?? I misunderstood. I really doubt there's any way to do this. All the code is being reloaded fresh and started over. Sounds like an XY problem, why don't you tell us what you're trying to do in the first place? Surely trying to continue the code execution after a page reload isn't the solution to your actual problem. – Jeremy Thille Nov 04 '20 at 11:07

0 Answers0