View Full Version : Generating URL
macbaseball
May 11, 2005, 06:37 PM
I'm trying to figure out how to generate a URL which then would be a link.
What I want to do is only change the middle part of a URL. Most of the codes I'm seen only can change the end of the URL. Could someone help me out.
superbovine
May 11, 2005, 07:01 PM
would you care to elaborate on what language you would be doing your project in?
macbaseball
May 11, 2005, 07:11 PM
would you care to elaborate on what language you would be doing your project in?
I'm trying to make a widget, so probably Javascript, or HTML.
robbieduncan
May 12, 2005, 05:38 AM
Basically you are on your own. If you are using the window.location object you can get the various parts of the URL:
If your document is at http://myhost.com:8080/my/folder/path/document.html?search=test#fred
hash: returns #fred
host: returns myhost.com:8080
hostname : returns myhost.com
href: the entire text
pathname: returns /my/folder/parh/document.html
port: returns 8080
protocol: returns http:
search: returns ?search=test
Notet that these are read/write so you can do (say) window.location.path = '/my/new/path/page.html';
If you just have a string then it's up to you to parse it.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.