Open all persons solution links from submission page using JavaScript
JavaScript is a high-level, interpreted programming language that conforms to the ECMAScript specification. jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and manipulation.
Example:
- Step 1: Open any geeksforgeeks solution page. Like open problem submissions page. Open the page in inspect mode by pressing F12 or through inspect option.
- step 2: Now copy and paste the below javascript code in the console window and press Enter. In 2.5 seconds all the solutions will be listed one by one.
Example:
<script> // Array to insert page links javascript: var arr = []; var i = 1; // Accessing the dom to find the "View solution" // link of each person's solution for(i = 1; i <= 30; i++) { var flag = false; if (document.getElementsByClassName("well table whiteBgColor") [0].children[0].children[i]) { var link = document.getElementsByClassName ("well table whiteBgColor") [0].children[0].children[i].lastElementChild.children[0] .href.trim().toString(); // If ith submission is not there // then break the loop flag = true; } if (!flag) { break; } arr.push(link); } // Opening multiple tabs with // the links in the array function open_win() { for(var i = 0; i < arr.length; i++) { console.log(arr[i]); window.open(arr[i]); } } // In 2.5 seconds multiple tabs will get // open with the search results links setTimeout(function() { open_win(); }, 2500); </script> |
Output:

Note: First run of the script a popup will come. We have to allow popups because Chrome wants to know if we want multiple tabs to be used or not. Then re-run the script.
Recommended Posts:
- How to disable HTML links using JavaScript / jQuery ?
- Display the number of links present in a document using JavaScript
- How to Open URL in New Tab using JavaScript ?
- Open a link without clicking on it using JavaScript
- How to disable right click on web page using JavaScript ?
- Scroll to the top of the page using JavaScript/jQuery
- How to modify URL without reloading the page using JavaScript ?
- How to run a function when the page is loaded in JavaScript ?
- How to check form submission in PHP ?
- How to dynamically change the title of web page using JavaScript ?
- How to make browser to go back to previous page using JavaScript ?
- How to disable dragging an image from an HTML page using JavaScript/jQuery ?
- Javascript | Window Open() & Window Close Method
- How to display search result of another page on same page using ajax in JSP?
- How to pass form variables from one page to other page in PHP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet

