Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>Multilink</title>
- <script type="text/javascript">
- //Based on http://goo.gl/Fv9R0O. I just cleaned it up as it had a couple of issues.
- function openLinks() {
- var regex = new RegExp("^http(s)?://");
- var allLinks = document.getElementById("alllinks").value;
- var arrLinks = allLinks.split("\n");
- for(i = 0; i < arrLinks.length; i++) {
- if(!arrLinks[i].length) {
- continue;
- }
- if(regex.test(arrLinks[i])) {
- window.open(arrLinks[i], '_blank');
- } else {
- window.open("http://" + arrLinks[i], '_blank');
- }
- }
- }
- </script>
- </head>
- <body>
- <textarea rows="20" cols="80" id="allLinks" placeholder="Paste all links here" autofocus></textarea>
- <br>
- <input type="submit" onclick="openLinks()" value="OPEN">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement