Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Natasha Lan
Natasha Lan
654 Points

External URL links - correct turn corrupt

Please see http://socialwork.utoronto.ca/practicum/practicum-administration-system/ and the temporary work around to this issue occurring in multiple browsers after cache cleared.

The functioning URL is https://www.oise.utoronto.ca/fsw/practicum/instructor/ and has been input that way.

Somehow when there is only one instance of the URL linked on the page it automatically points to the 'corrupt' link http://socialwork.utoronto.ca/practicum/practicum-administration-system/onclick=

All the other links on the page function properly. This is only occurring with the 'Field Instructor' link.

4 Answers

Inside of the WordPress admin area, go to the page containing the troublesome link. Now, at the top of the page editor, on the right side, there should be two tabs called "Visual" and "Text." Click the "Text" one.

Now, this should show you the HTML of the page. Remove the troublesome link entirely and then click "Update."

Natasha Lan
Natasha Lan
654 Points

Thank you Ryan, I have tried that but it still does not work (in IE 9). My colleagues have tested and it does not work in Firefox either.

The issue is that the troublesome link morphs itself into the next option. The workaround was including the link twice so that one would be trouble, the other would work. Now that we're back down to one it becomes the trouble.

Wow, that is weird. Let me do some snooping and I'll see what I can come up with.

Try uninstalling and reinstalling the Google Analytics plugin.

Natasha Lan
Natasha Lan
654 Points

SO WEIRD! I'm going to flip it back to the 2 posted links for now and try the analytics suggestion.

Be careful; Analytics will probably require a key in order to pass through setup again. Make sure you know the key before continuing. (Sorry, should've said this earlier.)

Natasha Lan
Natasha Lan
654 Points

Deactivating analytics worked! Now to uninstall and reinstall again.

selected best answer

If there any special JavaScript that's only attached to that page? I'm guessing "onclick=" is attached to a JavaScript Event. Could be a typo in your code that's throwing everything off.

Natasha Lan
Natasha Lan
654 Points

There shouldn't be JavaScript on the page...

I inspected the HTML in that particular webpage and this is the broken link's HTML:

<a href=" onclick=" __gatracker('send',="" 'event',="" 'outbound-article',="" 'https:="" www.oise.utoronto.ca="" fsw="" practicum="" student&quot;="" target="&quot;_blank&quot;&gt;Students&lt;br" &gt;\n&lt;="" a&gt;&lt;="" strong&gt;&lt;="" p&gt;\n&lt;p&gt;&lt;del&gt;&lt;a="" field="" instructors');"="" https:="" instructor="" "="">Field Instructors</a>

The problem is that the link's href attribute has an opening double quote, but not a closing one, so the browser does some goofy things to try to fix it and degrade gracefully.

All you need to do is add that missing double quote and place the desired link into the href attribute.

Hope this helps!

Natasha Lan
Natasha Lan
654 Points

I have not tried what you've suggested because the link that switches to "onclick=" points to a page that does not exist. The problem is that the correct URL in both cases switches to the "onclick=" in the first instance. If we remove the first instance altogether the second should work right? Wrong, the "onclick=" demon attaches itself to the remaining instance. Crazy right?!

The source code:

<h4><strong>Access for:</strong></h4><p><strong><a href="https://www.oise.utoronto.ca/fsw/practicum/student" target="_blank">Students<br /> </a></strong></p><p><del><a href="https://www.oise.utoronto.ca/fsw/practicum/instructor/" target="_blank">Field Instructors</a> </del> (This link is broken.  Please use the link below)</p><p><strong><a href="https://www.oise.utoronto.ca/fsw/practicum/instructor">Field Instructors</a></strong></p><p><strong><a href="https://www.oise.utoronto.ca/fsw/practicum/faculty/" target="_blank">Faculty-field liaisons</a></strong></p><p> </p><p><a href="https://legacy.oise.utoronto.ca/fsw/practicum/admin/" target="_blank">Administrators</a></p>

Notice how the following are the same save for trying to open in a new tab/window?

<a href="https://www.oise.utoronto.ca/fsw/practicum/instructor/" target="_blank">Field Instructors</a>
<a href="https://www.oise.utoronto.ca/fsw/practicum/instructor">Field Instructors</a>
Natasha Lan
Natasha Lan
654 Points

The best answer was Ryan Duchene's suggestion re: Google Analytics plugin. Thank you both for all your help!