...

View Full Version : Load multiple url's from array



Alex Timm
08-23-2011, 11:36 PM
I have a web page that opens urls in one seperate window from an array that uses settimeout to slow the loading. Is there coding i can use to replace settimeout that will allow the next url to load after each 1 loads. Here is what i have now.


var win = null;
var i = 0;
var links = [
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=53",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=57",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=194",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=196",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=242",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=286",
"http://www.ageofchampions.com/game/gift_accept.php?source=190&sourceu=505119169&wid=335",
];

function aufruf(idx) {
if(!win){
win = window.open();
};

win.location.href = (links[idx]);

if(idx < (links.length - 1)) {
idx++;
setTimeout('aufruf(' + idx + ')', 8000);
//or setTimeout('aufruf(idx)', 8000);
};
};

webdev1958
08-24-2011, 12:08 AM
Won't looping through your links array and using window.open() to open each link sequentially, without setTimeout, in a new window do what you need?

Alex Timm
08-24-2011, 12:13 AM
That would open them all in seperate windows. Windows doesn't like to open over 100 windows at once. I need them to only use 1 window. The var list is only a partial list.

webdev1958
08-24-2011, 01:54 AM
ok, but then I don't see the point of what you are doing because if you load the urls into the same window then as soon as one url finishes loading, the next will load automatically and so all you'll eventually see is the last page in the browser.

What am I missing here?

Old Pedant
08-24-2011, 02:11 AM
You are missing the fact that he is trying to collect lots of "points" of some kind for hitting that URL with different "wid" values. Since all the links he posted give identical content. In fact, if you omit everything but the base URL and just use
http://www.ageofchampions.com/game/gift_accept.php
you still get identical content. So the window content isn't *really* changing...just the "hits" being registered for those different "wid" values.

This assumes that the URLs he is interested in are the ones he actually showed.

Alex Timm
08-24-2011, 02:51 AM
That is correct. Currently we have to manually open the urls. Which takes time. By automating it in one page it can be started and forgotten about. The current code works, but if a page doesn't load in time the next one opens over it. Currently we have 35 members in our guild and 7 pages to open for each, that is 245 pages. So you can see how this page will help.

Old Pedant
08-24-2011, 02:56 AM
I know I'm going to regret this, but...

Don't do it like this, at all.

Use an AJAX style page open. And, yes, the AJAX open will tell you when it is finished loading the HTML.

WHOOOPS...but you'll need a server-side proxy to help you. A PHP page, for example, that will proxy to those foreign URLs.
But it would be a dirt simple proxy to write.

Alex Timm
08-24-2011, 04:02 AM
I don't have a server. I'm using a free website on yola.com.

Old Pedant
08-24-2011, 10:34 PM
So does yola.com offer you PHP? Or ASP? That's what I mean by a "server". You don't have to own it, you just have to have server side programming available.

Alex Timm
08-24-2011, 11:52 PM
I'm assuming PHP because of the website created http://imperialfists.yolasite.com/testing.php

I cannot change anything in the header only the body.

Old Pedant
08-25-2011, 12:04 AM
> I cannot change anything in the header only the body.

Sorry, I don't understand that. If you own the page, why can't you change anything you want to? Anyway, to create a proxy you would use a separate web page that does nothing except serve as the proxy.

On the other hand, if you have usage of PHP, you could do all of this in PHP and forget HTML/JS.

Alex Timm
08-25-2011, 12:33 AM
If php works better for this than i'm all for it. I just don't know how to do it.
How can I verify that I do have access to PHP.

Old Pedant
08-25-2011, 01:13 AM
Well, clearly you have access to PHP else the name of your web page wouldn't be
http://imperialfists.yolasite.com/testing.php

But apparently Yola won't let you create your own PHP. From their FAQs:

How do I add PHP scripts to my site?

For security reasons, including PHP scripts in your Yola site is not currently a feature within the Yola Sitebuilder.

So forget that idea.

Sorry.

Alex Timm
08-25-2011, 01:28 AM
Thanks for trying to help. I guess it's not possible with my feeble knowledge of programming.

jmrker
08-25-2011, 04:29 AM
That is correct. Currently we have to manually open the urls. Which takes time. By automating it in one page it can be started and forgotten about. The current code works, but if a page doesn't load in time the next one opens over it. Currently we have 35 members in our guild and 7 pages to open for each, that is 245 pages. So you can see how this page will help.

I guess I don't understand the purpose of the script desired. :confused:

If you open a large number of pages (over a 100) and never look at them because they load sequentially one after the other, what is the purpose? :confused:

If someone is paying for a number of hits to their site, it seems rather dishonest to elevate that count if there a no real lookers! :eek:

What is the real purpose of this type of script if not the above? :confused:

Alex Timm
08-25-2011, 04:38 AM
It's for a game. It is called titan cranking. It is not dishonest. It is allowed by the game developers. There is no money involved. There is nothing to read on the page except for saying "Thank you for cranking so.and.so's titan".

jmrker
08-25-2011, 03:15 PM
it's for a game. It is called titan cranking. It is not dishonest. It is allowed by the game developers. There is no money involved. There is nothing to read on the page except for saying "thank you for cranking so.and.so's titan".

ok

:d



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum