I have a JS file on site A which reads a few parameters from a short text file on site B.
The call is made through:
var theFile = getFile("http://www.mySiteB.com/theTextFile.txt");
var lines = theFile.split("\
var var1 = lines;
var var2 = lines;
var var3 = lines;
The problem is that this takes a long time. I would really like to speed this up. For example - I thought of using a direct IP address, so that there won't be any need a DNS server (using
var theFile = getFile("http://126.96.36.199/~myUsername/mySiteB/theTextFile.txt");
) but this would expose me to hackers as it would make my Hostgator username visible. According to HG support the above format is the only way to access my subsite via direct IP.
Any ideas on how to speed this up, either by bypassing DNS (but without exposing username) or by offering another way of reading data across sites?
This is really important for me!
Can you cache the contents of the file into your own server? or are the values created dynamically every time?
If you can cache it then save a copy locally and read that copy instead, and just refresh as you think necessary, that way the load will only be painful for one user and not all of them
Who says you'd get any speedup if you bypassed DNS lookup? Have you even tried it so you can safely assume it's the DNS lookup that makes it slow?