- Quick Fixes
- Improving the Pop-Up Pages
- The Final Touches
- Summary
The Final Touches
Unfortunately, the customer wasn’t happy with that solution, either. Whenever the visitor positioned the mouse over a link in a product catalog page, a long, ugly URL appeared in the browser’s status bar. Back to the drawing board.
By now, several facts were obvious:
- We needed <A HREF=url> tags in the pages; otherwise, search engines wouldn’t find the content.
- No tweaking of attributes would change a hyperlink (<A> tag with HREF attribute) into an anchor (<A> tag without HREF attribute).
- It was impossible to stop the default browser behavior of showing the URL in the status bar whenever a mouse was positioned over a hyperlink.
- As we couldn’t use the hyperlinks to open pop-up windows, we needed onclick events, but they couldn’t be attached to a hyperlink (see the previous item).
The final solution thus had to involve a few tricks. We didn’t want to use the outerHTML attribute (whereby we could re-create a hyperlink into something else), so we decided to wrap each hyperlink into a SPAN section:
<span class=’popupLink’><a href=’url’>Text</a></span>
The convertPopupLinks function was also modified to do the following:
- Find all SPAN tags with popupLink class.
- Within each SPAN tag, find the <A> tag and extract the target URL from it.
- Replace the contents of the SPAN tag with the contents of the <A> tag.
- Create an onclick event for the SPAN tag that will open the target URL in a pop-up window.
Thus, with a few tricks, we achieved the exact results the customer wanted.