View Full Version : :: need to grab some info from the url - how? ::

07-23-2002, 02:43 PM
ok so ive built a search engine in lotus notes (booooo hiss blumin boss and his notes servers) anyway the url for searching is like this:

http://wwwnotesint/IT/DEVELOPMENT/liam.nsf/Search?SearchView&Query=SEARCHWORDS IN HERE&SearchFuzzy=1 (obviously the spaces are converted to % 2 0)

now, i want a script that pulls the info from the address bar and document.writes it somewhere - how can i do this? bearing in mind im not very good at javascript ;)


07-23-2002, 03:35 PM
oops - the url has been mutated :)

ok this is the url :

host/IT/DEVELOPMENT/searchtest.nsf/Search?SearchView&Query=SEARCHWORDS IN HERE&SearchFuzzy=1

how can i strip the bit b4 the = and after the &?

thanks all!

07-23-2002, 04:51 PM
ok i found a way to do it:

<script language="JavaScript" type="text/javascript">

if (document.location.href != 'http://www.simonsgroup.com/IT/DEVELOPMENT/liam.nsf/Search?SearchView&Query=aaaaaaaaa&SearchFuzzy=1') {
var searchurl = document.location.href;
var compact1 = searchurl.split('http://www.simonsgroup.com/IT/DEVELOPMENT/liam.nsf/Search?SearchView&Query=');
var compact2 = compact1[1].split('&SearchFuzzy=1');
var output = compact2[0].split("%20").join(" ");

:D :D :D i am slowly picking this js up i think :)
btw is there a better way to do the above or will i have problems anywhere?

07-23-2002, 04:55 PM
btw the aaaaaaaaaa bit is the way i link to the page in the 1st place - blumin notes suck more than elton john ;)

07-23-2002, 04:58 PM

looks like you worked it out while i was writing this. here's my idea.

searchString = location.search.split("=")[1].split("&")[0]

location.search is everything from and including the ? in the URL:
"?SearchView&Query=SEARCHWORDS IN HERE&SearchFuzzy=1"

.split("=") returns an array of all the substrings separated by the = character:

[1] returns the second item from this array:

.split("&") returns an array of all the substrings separated by the & character:

[0] returns the first item from this array:

this ok? of course, this only works for this example, if the SearchView param was missing or if the SearchFuzzy param was put in front of the Query param, you'd get some other value.
if you want to sort out these situations, you can write a more complex script that splits the location.search into items separated by "&" and then eval()s each one of them, making the URL params into variables directly.


07-24-2002, 12:29 AM
Is this what you're looking for? (http://www.nullinteractive.com/offerings.shtml)

07-24-2002, 08:49 AM
thanks guys!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum