Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Calling a .js that is 12.9mb


Fess - 12:19 am on Dec 27, 2012 (gmt 0)


Hello Webmasters,

Been away for a long time, good to be back..
Seeking constructive input from javaScript Artists as my knowledge is limited in this area.

When I started using the below script, the external .js was about 2.1mb (2007).
To date the external .js is about 12.9mb with over 100,000 lines of links.

Problem:
Calling a 12.9mb .js does not work in Firefox or it does not completely load. It works in Safari.


--------------------------------------------------------------THE SCRIPT

This is the external .js:

function GetRandom(start,end)
{
var range = end - start + 1;
var result = start + Math.floor(Math.random()*range);
return result;
}

function getRandomLink(whichSet) {
contentlinks = new Array("http://forums.example.org/showthread.php?f=154&t=449125",
"http://forums.example.org/showthread.php?f=154&t=451100",
"http://forums.example.org/showthread.php?f=154&t=449581",
"http://forums.example.org/showthread.php?f=154&t=450662",
"http://forums.example.org/showthread.php?f=154&t=449114");

trafficlinks = new Array("http://www.example1.com",
"http://www.example2.com/zbrush/home/home.php",
"http://www.example3.com/",
"http://www.example4.com/",
"http://www.example5.com/",
"http://www.example6.com/");

if (whichSet==0) { window.open(contentlinks[GetRandom(0,contentlinks.length-1)]) }
else if (whichSet==1) { window.open(trafficlinks[GetRandom(0,trafficlinks.length-1)]) }

}

--------------------------------------------------------------

This goes in between the <head> </head> tags:

<script type="text/javascript" src="http://www.mydomain.com/machoRand.js"></script>

--------------------------------------------------------------

This goes in between the <body> </body> tags:

<A href="#" onclick="getRandomLink(1);return false;"><font face="Arial"><u>resources</u></font></A>
<A href="#" onclick="getRandomLink(0);return false;"><font face="Arial"><u>amimations</u></font></A>

--------------------------------------------------------------

Can anyone give me some alternatives to calling the 1 big .js via putting this in in between the head tags <script type="text/javascript" src="http://www.mydomain.com/machoRand.js"></script> ?

Maybe I can have several smaller "machoRand.js"and have some code to pull random:
machoRand00.js
machoRand01.js
machoRand02.js
machoRand03.js


Any input is much appreciated
Best,
Fess


Thread source:: http://www.webmasterworld.com/javascript/4531247.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com