admin管理员组

文章数量:1415438

I am using chrome console to get data from one site with these 2 mands.

window.location.replace(link);

document.forms[2].submit();

Is there any way to run theme together in the same line or make a loop ?? Because i want to run in many times

I am using chrome console to get data from one site with these 2 mands.

window.location.replace(link);

document.forms[2].submit();

Is there any way to run theme together in the same line or make a loop ?? Because i want to run in many times

Share Improve this question edited Oct 22, 2014 at 8:12 CodingIntrigue 78.7k32 gold badges176 silver badges177 bronze badges asked Oct 22, 2014 at 7:29 SaksooSaksoo 532 silver badges7 bronze badges 6
  • 2 crate a function and execute it.. – Vicky Gonsalves Commented Oct 22, 2014 at 7:31
  • 1 Or just write them one after another: window.location.replace(link); document forms[2].submit(); – Pete TNT Commented Oct 22, 2014 at 7:33
  • Or use an IIFE, or use Shift+Enter to drop onto a new line without executing. This is a Chrome issue, not a programming one. – CodingIntrigue Commented Oct 22, 2014 at 7:33
  • @RGraham I don't agree: Chrome developer tools is for debugging, so it's a tool for programmers. So the question is not off-topic, in my opinion – Pablo Lozano Commented Oct 22, 2014 at 7:59
  • @Pablo Fair point, vote retracted – CodingIntrigue Commented Oct 22, 2014 at 8:00
 |  Show 1 more ment

1 Answer 1

Reset to default 6

Chrome Dev Tools Snippets FTW

Open Dev tools, navigate to the Sources tab, open the sidebar on the left, and open the Snippets tab. Now right click and create new snippet, put your code inside it, and run it via Ctrl+Enter. These snippets stay there untill you delete them, even after chrome restart. They are very powerfull and easy to use.

Read more in the official article Authoring Development Workflow #Snippets

本文标签: javascriptRunning commands from chrome consoleStack Overflow