views:

100

answers:

2

How can I do a script to catch strings as input and open them on a Firefox document? Each link would go to a different window or tab. Any ideas would be much appreciated.

I just want to be able to take some links and open them. For example I have 50 Links. And copying and parsing those 50 Links take a really long time and also a lot of work. If I can just write a script to read those links and let the computer do the work, it will be very helpful for me. I just don't know how to write that or where because it does not sound too hard (just gotta know how to). Thanks for any suggestions.

A: 

Write this to a file names "links.html" on your hard disk:

<html>
<head><title>Your links</title></head>
<body>
Your links:<br />
<a href="XXX">XXX</a><br />
</body>
</html>

Replace the two "XXX" with one link and emit one "link" (a) line per link. You should be able to do that in most text editors with a little search'n'replace. After you're done, save the file and open it in your browser.

Another option is to look at the bookmark file of your browser and to duplicate the format. You can usually ignore things like "last visited", etc. Just add the links.

If you want to do this in JavaScript, you will need to use a form with a textarea. Create a small HTML document with a form, the JavaScript, the textarea and a div for the result.

Add a button which calls a JavaScript function which takes the text from the textarea, split it into lines and create the HTML above (only the link-lines) as a String. Now assign this string to the attribute innerHTML of the div to make the links clickable.

Aaron Digulla
A: 

if i got you right, i guess you could do something like this. This will open the four urls listed but it will probably be blocked by the popup blocker.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<script>
<!--
    var dir = new Array();
    dir[0] = "http://www.creativecorner.cl/";
    dir[1] = "http://www.sourcing.cl/";
    dir[2] = "http://www.feeds.cl/";
    dir[3] = "http://www.neonomade.com/";
    for(i = 0 ; i < dir.length ; i++){
     window.open(dir[i],'autowindow' + i,'width=1024,height=768');
    }
-->
</script>
</body>
</html>