Web Analytics Made Easy -
StatCounter Load multiple url's from array - CodingForum

Announcement

Collapse
No announcement yet.

Load multiple url's from array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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?

    Comment


    • #3
      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.

      Comment


      • #4
        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?

        Comment


        • #5
          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.
          Be yourself. No one else is as qualified.

          Comment


          • #6
            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.

            Comment


            • #7
              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; Aug 23, 2011, 11:19 PM.
              Be yourself. No one else is as qualified.

              Comment


              • #8
                I don't have a server. I'm using a free website on yola.com.

                Comment


                • #9
                  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.
                  Be yourself. No one else is as qualified.

                  Comment


                  • #10
                    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.

                    Comment


                    • #11
                      > 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.
                      Be yourself. No one else is as qualified.

                      Comment


                      • #12
                        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; Aug 24, 2011, 08:48 PM.

                        Comment


                        • #13
                          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.
                          Be yourself. No one else is as qualified.

                          Comment


                          • #14
                            Thanks for trying to help. I guess it's not possible with my feeble knowledge of programming.

                            Comment


                            • #15
                              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?

                              Comment

                              Working...
                              X