Here’s a small UDF to split any URL into it’s base, query string, and anchor parts. Hope you find it useful.
function splitUrl(inUrl) {
var s = inUrl;
var refUrl = "";
var refQS = "";
var refAnchor = "";
var st = structNew();
var i = find("?", s);
if (i) {
refUrl = left(s, i-1);
refQS = mid(s, i+1, 99999);
i = find("##", refQS);
if (i) {
refAnchor = mid(refQS, i+1, 99999);
refQS = left(refQS, i-1);
} else {
refAnchor = "";
}
} else {
i = find("##", s);
if (i) {
refUrl = left(s, i-1);
refAnchor = mid(s, i+1, 99999);
} else {
refUrl = s;
}
}
st.url = refUrl;
st.queryString = refQS;
st.anchor = refAnchor;
return st;
}
Had a request in the MM forums for a few more details, so I added on to your function. This returns Anchor, Domain, Path, Querystring and URL
function splitUrl(inUrl) {
var s = inUrl;
var refUrl = “”;
var refQS = “”;
var refAnchor = “”;
var st = structNew();
var i = find(“?”, s);
if (i) {
refUrl = left(s, i-1);
refQS = mid(s, i+1, 99999);
i = find(“##”, refQS);
if (i) {
refAnchor = mid(refQS, i+1, 99999);
refQS = left(refQS, i-1);
} else {
refAnchor = “”;
}
} else {
i = find(“##”, s);
if (i) {
refUrl = left(s, i-1);
refAnchor = mid(s, i+1, 99999);
} else {
refUrl = s;
}
}
if (find(“?”, s) and Find(“/”,inUrl,9)) {
st.path = Mid(inUrl,Find(“/”,inUrl,9),find(“?”, s)-Find(“/”,inUrl,9));
} else if (find(“?”, s)) {
st.path = “/”;
} else {
st.path = RemoveChars(inUrl,1,Find(“/”,inUrl,9));
}
st.domain = Left(refUrl,find(“/”,inUrl,9)-1);
st.url = refUrl;
st.queryString = refQS;
st.anchor = refAnchor;
return st;
}
Let me just paste a link, as pasting any code causes problems…
http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=7&threadid=682923
Hello there,
Iwas browsing the web and found this blog. Some interesting quotes. Keep them coming!
Alice
online home loans
Nice siteGod knows
Bye!
Jill Jones
Welcome Home Everyone Home
Cya
Max
By Philip Pullella and Thomas Grove. ISTANBUL, Turkey (Reuters) – Pope Benedict embarked on Wednesday on his second mission in Turkey, to improve ties between Roman Catholics and Orthodox Christians, after …
gym-class-heroes
coach handbags
buy phentermine.
phentermine pharmacy.
Your guestbook is example of middle-class guestbooks. Congratulation! I’ll show your site and guestbook to my friends.d
internet pharmacy internet pharmacy
COol
Hi, everything is going nicely here and ofcourse every
one is sharing information, that’s truly excellent, keep up writing.
Thank you for sharing. I am fascinated with your site. I am going to publish
this to my facebook wall.
Feel free to visit my page how to get rid of back acne scars (yolasite.com)
Hello! Excellent stuff here, please keep us posted.
Here is my weblog :: Best Acne Products (collierrzswz1y.jux.com)
???????????? ? ???? ????,??????? ???????????? ? ????,??????? ???????????? ? ???? ???????,?????? ???????????? ? ????,?????? ???????????? ? ???? ???????,???????????? ???? ???? ??????,???????????? ? ???? ???? ??????,???????? ?????????? ????,???????? ???? ?????????? ????,??????? ????? ? ????,??????? ????? ? ???? ??? ????????,??????????? ????? ? ????,??????????? ????? ? ???? ????
???????????? ? ???? ????,??????? ???????????? ? ????,??????? ???????????? ? ???? ???????,?????? ???????????? ? ????,?????? ???????????? ? ???? ???????,???????????? ???? ???? ??????,???????????? ? ???? ???? ??????,???????? ?????????? ????,???????? ???? ?????????? ????,??????? ????? ? ????,??????? ????? ? ???? ??? ????????,??????????? ????? ? ????,??????????? ????? ? ???? ????
???????????? ? ???? ????,??????? ???????????? ? ????,??????? ???????????? ? ???? ???????,?????? ???????????? ? ????,?????? ???????????? ? ???? ???????,???????????? ???? ???? ??????,???????????? ? ???? ???? ??????,???????? ?????????? ????,???????? ???? ?????????? ????,??????? ????? ? ????,??????? ????? ? ???? ??? ????????,??????????? ????? ? ????,??????????? ????? ? ???? ????