473,487 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there any function to retrieve top most directory from a give site?

6 New Member
I put all image in /image. It was working fine many years ago. Now, I have to change to
var url = "http://jinpusa.angelfire.com/image/"; this in order to have it work correctly.
I want this code to be portable and bring to any web site without having to edit it.
Is there any alternative for not specifying the whole path?

Expand|Select|Wrap|Line Numbers
  1. function init_image()
  2. {
  3. //      var url = "http://jinpusa.angelfire.com/image/";
  4. //     var url = "http://mysite.verizon.net/solang/image/";
  5. //     var url = "./";
  6.       var url = "/image/";
  7.        pieces[ 0]="SQUARE.JPG";
  8. //       pieces[ 0]="NPAWN.JPG";
  9.        pieces[ 1]="NPAWN.JPG";
  10.        pieces[ 2]="NFPAWN.JPG";
  11. .
  12. .
  13.        for (var i=0; i<pieces.length; i++)
  14.        {
  15.            pieces[i] = url + pieces[i];
  16.        }
  17. }
Nov 24 '10 #1
5 1295
Dormilich
8,658 Recognized Expert Moderator Expert
if the image folder is always in the same place from the root directory, you can try
Expand|Select|Wrap|Line Numbers
  1. var url = "http://" + location.hostname + "/image/";
Nov 24 '10 #2
Eng Born
6 New Member
You suggestion is almost correct, but it gave me
http://mysite.verizon.net/image/
instead of the correct one like
http://mysite.verizon.net/solang/image/
I still have no clue how to add owner of a given web site.
Thanks,
Eng
Nov 24 '10 #3
Eng Born
6 New Member
The problem is complicated, at least two different servers like Verizon and Angelfire have different way of assigning its user the web location/directory.
verizon gives http://mysite.verizon.net/solang
while angelfire gives
http://jinpusa.angelfire.com/.
With the old way, / worked for both site in assging top most directory and HTTP new version remove that.
Your suggestion work perfectly for angelfire, but it won't work on Verizon.
Nov 24 '10 #4
Dormilich
8,658 Recognized Expert Moderator Expert
then you can only use relative paths
Nov 24 '10 #5
Eng Born
6 New Member
That won't do neither because player might put his/her page down the directory tree. I just have to let the user edit the file to put his/her topmost web site.
Anyway, thanks.
Nov 24 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5405
by: Peter Saffrey | last post by:
(apologies for starting a new thread - Google can't retrieve the other message for some reason) Yes, /usr/lib/python/site-packages is in sys.path. This series of commands should explain what I...
0
1121
by: Microsoft | last post by:
Is there a way to to retrieve Directory Property information? I am trying to develop a way to monitor total Directory size say any directory over 200 meg. I have the logic to enumerate the...
5
1748
by: L. L. | last post by:
Hi All, Is it possible to retrieve the web site information running on the local box? For example, I want to know the names of all web sites, the virtual directory information and physical path...
1
1450
by: Malik Asif Joyia | last post by:
Hello I want to implement the forms based authentication. for a sub directory in my webapplication. I have allready applied Forms based authentication in my webapplication ,, I have added a folder...
1
2564
by: onceuponapriori | last post by:
Greetings gents. I'm a Railser working on a django app that needs to do some scraping to gather its data. I need to programatically access a site that requires a username and password. Once I...
5
2686
by: GenCode | last post by:
What is the best way to read a "readable" web directory... I know I can do this Client.DownloadFile("http://www.mydomain.com/readabledir/", c:\ \dir.txt"); But that gives me the html and all...
8
1793
by: Paul W Smith | last post by:
I currently have a web site at www.middlesexccl.com I am also developing a new version of the web site using ASP.NET. I would like to give certain people access to this for evaluation purposes,...
9
2081
by: pythonewbie | last post by:
Hi all, I am newbie in Python, my wish would be to create python applications for both Linux/Win32. I am stucked on creating a function to get the Python install directory (and site-packages...
2
2384
by: Gordon | last post by:
I'm trying to remove a directory and all its contents from within a script. I wrote a recursive function to take care of it, but when I run it I get random "Directory not empty" error messages. ...
1
5636
by: Steve | last post by:
My site is hosted on a Godaddy reseller site. Godaddy only allows the use of Curl to access remote sites. What is the method for listing a directory after connecting to the site with Curl? ...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.