For years now I've had this script running that polls the page for new window classes and writes up their contained links to include target="_blank" and the appropriate window.open method. Old school, but working flawlessly all these years. Until now.
This site has never had any OBL's with a HASH in the URL, so was not prepared for the confusion I experienced today. I ran around plugging in inspector scripts all over the place to view the collections at every point only to discover that the problem was my hash filter.
Nothing was not working as it should. In fact, everything was working as it should. Sheesh...Code:JavaScript function inPage(x) { return x.match(/\/#/); };
Wikimapia has a hash in the URL of their map locations. My filter was negating these links on the basis of this alone and it took me two hours to figure this out, all because I was suspicious of my own code.
Had I actually made the connection when I first laid eyes on the URL in the location bar, it would have gone without a hitch. I would have said, "Gonna need a counter-effect for this one." and gone ahead and created one. But such is the realm of working with old code, whether we created it or not. If we don't study it well enough, it can come back and bite us. I was sending visitors to a 404 page that Wikimapia was gracious enough to make a pleasant experience, albeit futile. I didn't study this code well enough when I created this filter.
This short-sighted filter can be slighted with a simple counter-measure encoded right in the URL's, namely, '%23' in place of '#'. This in itself is adequate enough to get around my filter. But it slammed the door shut with a 404 at the other end. So I got around the filter but I negated the resource I am aiming at. Really smart. Scramble...
As long as this happens after the filter, there's no problem with the URL.Code:JavaScript function hashEncode(x) { return (x.replace(/%23/,"#")); };
Lesson learned: Never think one's code is bullet proof, and study the situation before you spend hours debugging something that already works. It's not always the real code, it is sometimes the MISSING code.
<edit>
Now the real problem is going to be how to give the unscripted client the correct URL. It just never ends, does it?
</edit>
Submit Your Article
Forum Rules

Reply With Quote
