Prizes & Awards
My Profile
Active Members
TodayLast 7 Days
more...
|
Resources » Articles » General »
[Review] Quick and Elegant Request-QueryString library in JavaScript
|
Introduction Every ASP or ASP.NET developer would have sometime or other managed with some form of data interchange or exchange across the various pages in his application in any of the available styles like QueryStrings, Forms, Hidden Fields, Sessions, Cookies. Well! I am not going to bore you with all these interview jugglery over here and that is not the purpose of this quick note either.
With the latest trend of making webpages more responsive to the user inputs, we use extensive JavaScript and AJAX techniques. Also, on the security aspects, the web servers now come with 'locked down' mode meaning, the required technologies like ASP, ASP.NET can be enabled only upon need. The plain vanilla HTML and JavaScript is always available for the user to render.
The Necessity Under the circumstances that we described above, it would be better to have a dynamic Page Input parsing facility for our HTML Pages. The built in ActiveScripting facility of the web browser and JavaScript lends a great helping hand to us in this context. With as little JavaScript and supportive regular expressions, you can have as much powerful and smart webpages that can parse thier inputs themselves thus complementing its serverside counterparts besides technology concepts like AJAX.
The Quick Request.QueryString Lirbary The elegance of JavaScript for page input parsing is quite interesting. But it is as slippery as an eel. Since JavaScript is a kind of loosely typed scripting language, unless you are very much careful regarding indexes and string delimiters, you may be ending up in damaging the integrity of data in the case of URLs where long query strings are involved.
I came across an elegant library called Request.QueryString in JavaScript which is an open source script. The download URL is here: http://andrewu.co.uk/tools/request/
I would like to summarize a few advantages and disadvantages of this script over here which I guess would be beneficial for web page developers:
1) Open source with redistributable rights. So no copy rights to worry about and to please your project lead. 2) Simpler JavaScript that gets rendered and processed. This means lesser burden of page processing on the server. This also makes easier debugging too. 3) Roundtrips can be significantly avoided in case of subdomain navigations and use of IFRAMEs (typical with RemoteScripting and XmlHttp). 4) Familar ASP and ASP.NET syntax and nomenclature like Request.QueryString("name"), Request.QueryString ("id") 5) Quick Utility methods like Count(), Key(), Item() similar to ASP so that the learning curve is relatively less in incorporating the library in our webpages. 6) Efficiently incorporates into pages since just about a single .JS file is included.
Limitations:
I would not call it disadvantages but only limitations since we can work it around easily on a case-by-case basis.
1) The JavaScript Page Parsing logic is open to all even prying eyes and hackers. Hence the hackers might inject harmful inputs according to the weaknesses prevailing in the script or circumventing the protective mechanisms built therein.
2) The Page Parsing might not work in downlevel (script challenged) browsers where the control has to flow back to the server.
Summarizing...
I would say that Request.QueryString for JavaScript is quite elegant library in our day-to-day web programming needs with the trend of making use of web browser's horsepower more gracefully. Albeit there are a couple of advantages on a case-by-case basis like input validations and browser type checking, we can overcome the same.
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|