I faced a problem receiving the querystring params using only JS code.
Scratching the web I found examples of JS functions which rely on document.location.search to retrieve the querystring, then parsing it into oject.property=value
This solution works well on standard URL (which Domino generates by default):
myserver.com/db.nsf/docUNID?OpenDocument¶m1=value1
This is because the document.location.search would return everything after the question mark, meaning OpenDocument¶m1=value1
But what we can do when the Domino generated URL is:
myserver.com/db.nsf/docUNID!OpenDocument¶m1=value1 ?
This change can be performed server-wide by setting a parameter into the server document, then all generated URL will change the question mark with the exclamation mark. And in this case, document.location.search would be empty :)
My solution was something like this:
if(document.location.search=="") {
if (document.location.href.indexOf('!') != -1) qryString = document.location.href.substring (document.location.href.indexOf('!')) ;
} else {
qryString = document.location.search ;
}
meaning that if location.search is empty, I search for the first ! into the location.href and assume everything after is the querystring to be searched for required parameters. Not sure if this is the best approach, though ...
No comments:
Post a Comment