If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

You should be aware that document.write() statements must (as here) be run before the page finishes loading. Any document.write() statement that runs after the page finishes loading will create a new page and overwrite all of the content of the current page (including the Javascript which called it). So document.write() is at best really only useful to write the original content of your page. It cannot be used to update the content of your page after that page has loaded.

"I know that you believe that you understand what you think I said, but, I am not sure you realise that what you heard is not what I meant". (Robert
McCloskey)

Last edited by Philip M; 03-03-2012 at 04:54 PM.

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.

the program I'm using should create the URL, but I personally can't know what the title of each page is until the list is generated, I need the links to TELL me what they point to (in depth) WITHOUT me having to following hundreds of links to SEE what they are. I'm wondering if there's a way for the program to receive a cookie from each URL? or ask the given URL what it's title is, THEN make that the anchor text for the links?

ex:

susies website
dans website
roberts website

***BUT I had no idea whose websites would appear in the list, the program found out by using the URL given.

You should be aware that document.write() statements must (as here) be run before the page finishes loading. Any document.write() statement that runs after the page finishes loading will create a new page and overwrite all of the content of the current page (including the Javascript which called it). So document.write() is at best really only useful to write the original content of your page. It cannot be used to update the content of your page after that page has loaded.

Nowadays, document.write is largely considered antiquated and should not be used at all unless for writing to a new page from a parent page.

To write to the current page, best practice nowadays is to use the apropriate DOM methods like createElement(), appendChild() etc etc etc.

the program I'm using should create the URL, but I personally can't know what the title of each page is until the list is generated, I need the links to TELL me what they point to (in depth) WITHOUT me having to following hundreds of links to SEE what they are. I'm wondering if there's a way for the program to receive a cookie from each URL? or ask the given URL what it's title is, THEN make that the anchor text for the links?

ex:

susies website
dans website
roberts website

***BUT I had no idea whose websites would appear in the list, the program found out by using the URL given.

Is there a way to do this? any help is greatly appreciated!

Yes this can be done, but it should be done server side using something like PHP. I doubt it can be done client side.

You could open the remote page, parse the <title> tag and extract its contents. Then you can use the title contents however you like to make links or whatever.

it wont work without invoking some type of server side logic. if you were to try to use javascript to request an external resource (such as the URLs of your link) with AJAX, it would fail to work properly for security reasons.

So instead of making a list of hyperlinks, say I just want to filter some of the results of my generated links.

...

So if i save 1000 pages, whose URLS are generated from the loop, I can easily see which are valid and which aren't.

???

if you can get a page of link that point to the files you want, you can use the "downthemall" firefox extension to grab all linked pages from that page.

It will tell you which ones worked and which ones didn't, and you can save the list or re-fetch from there...

once you have the pages in a folder you control, you can use ajax to search the contents.
If this is something that served to the public, you will probably want to do your searching on the server-side so that 1000 files don't need to be download and searched...

Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com