Discobiscuits
Member
Posted 1 year ago #
Hey guys, I'm trying to get all the links located at http://www.guardiansilverosl.com to have >> onclick="exit=0", that way a popup script to be loaded when users exit the page will fire without interfering with users simply navigating around the site. The only way to do this is add that tag, onclick="exit=0", to every anchor link.
The problem is I can't figure out a way to get the dynamically generated links (top navigation, wp_list_pages, as well as the "List of All Pages" widget on the right side.)
Could there be a simple way for me to add onclick="exit=0" to all WordPress-generated links? If so, please point me in the right direction :)
-Ryne
You have to implement filters to alter the generated links. For example, for the permalink you can implement the_permalink filter. Please refer to codex documentation on how to implement the filter.
Discobiscuits
Member
Posted 1 year ago #
Exactly what I'm trying to do is convert every generated link to include 'onclick="exit=0"' in means to disable a <body onunload=""> javascript event. One of our customers is taking the old school route and is trying to get a popup to show up whenever the user exits a page. The only problem is that when the user clicks on a link, it'll have the same effect, because it's based around the <body onunload=""> event. The only workaround is to convert every link on the page to have 'onclick="exit=0"', or else the popup will show up when they're just browsing the website.
I'm checking out the codex documentation and that link right now... I'll get back if I found the solution.
Discobiscuits
Member
Posted 1 year ago #
Ehh, still no good.
All I want is to turn my links from (i.e)
this is a link
to
this is a link
i don't know how can make it any clearer than that :O Hallsofmontezuma - that plugin just applies a jQuery effect to page-based (#) anchor links... nowhere near what I was looking for, but thanks for trying :)
Discobiscuits
Member
Posted 1 year ago #
err sorry -
<a href="link.html" class="linkclass">this is a link</a>
to
<a onclick="exit=0" href="link.html" class="linkclass">this is a link</a>