Ken's Voyages Around the Sun


JavaScript FTW
Previous Entry :: Next Entry

Read/Post Comments (0)
Share on Facebook
Sometimes a little flash of insight is a wonderful thing.

For example, at work we have this little customer Contact Us web page with script and database backend system.

This system records a person's query and guides it to the correct staff member for a response, based on the section of our web site where the visitor was when it was used. Sometimes, however, the person wants to know about some other subject area so the query goes to the wrong staff member.

To handle this, our system allows one staff member to redirect the question to another staff member for a response. This generates an email to the new staff member so that he or she can respond to the original query simply by clicking a linked URL in the message.

Unfortunately, some email programs break the linked URL into two lines, which results in a non-functional situation because parameters needed in the second line don't go to the web browser when the link in the email is clicked.

Those who recognize the problem can try to copy and paste the two-line URL into the web browser's location bar, but this often fails too: the web browser accepts only one line.

Beyond this, a person can open a text editor and paste the two lines together, or copy and paste twice from the email into the browser to form one long one there, but these are awkward and error-prone approaches that will result in our staff not responding to someone. So, something better is needed, preferrably without mucking about with the original URL or parameter names or values.

My approach was to have the script behind our system recognize that the URL was broken, then show our staff member an error message and ask him or her to copy and paste the entire URL into a box sized to handle it.

After the multi-line URL is pasted in, and the staff member clicks a button, a tiny JavaScript re-creates it, then tells the browser to open to the corrected URL. Bingo.

Anyway, the solution came in a flash and turned out to be rather simple to implement. That makes me happy.





Read/Post Comments (0)

Previous Entry :: Next Entry

Back to Top

Powered by JournalScape © 2001-2010 JournalScape.com. All rights reserved.
All content rights reserved by the author.
custsupport@journalscape.com