Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Load multiple url's from array

    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.

    Code:
    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);
      };
    };

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    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?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,614
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,614
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    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.
    Last edited by Old Pedant; 08-24-2011 at 04:19 AM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #8
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I don't have a server. I'm using a free website on yola.com.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,614
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,614
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    > 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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #12
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.
    Last edited by Alex Timm; 08-25-2011 at 01:48 AM.

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,614
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Alex Timm (08-25-2011)

  • #14
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for trying to help. I guess it's not possible with my feeble knowledge of programming.

  • #15
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    39
    Thanked 505 Times in 499 Posts

    Question

    Quote Originally Posted by Alex Timm View Post
    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.

    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?

    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!

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


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •