Title: Not Keeping No Follow &#8211; Javascript Fix
Last modified: August 31, 2016

---

# Not Keeping No Follow – Javascript Fix

 *  Resolved [Chad Hayton](https://wordpress.org/support/users/chadhayton/)
 * (@chadhayton)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/)
 * I am running Ultimate NoFollow 1.4.3 and my users have complained that the nofollow
   checkbox on the link overlay is not properly showing if a nofollow value has 
   been set on a link. After a page refresh the checkbox is always blank regardless
   of whether or not the rel=”nofollow” attribute is set in the anchor tag.
 * I tracked the problem down to this snippet of Javascript where neither “ed” nor“
   e” are defined:
 * **Current Code on lines 234-235**
 *     ```
       // Set rel="nofollow" (mod)
       	if ( "nofollow" == ed.dom.getAttrib(e, 'rel' ) )
       		inputs.relNofollow.prop('checked', true);
       ```
   
 * I refactored this code to match more with the “_blank” checkbox logic and it 
   seems to be working better:
 * **Code Updates**
 *     ```
       // Set rel="nofollow" (mod)
       	inputs.relNofollow.prop('checked', "nofollow" === editor.dom.getAttrib(linkNode, 'rel' ));
       ```
   
 * Can we validate this change and push it into an update? Maybe 1.4.5?
 * I’ve seen a couple other complaints on this same issue, but no response:
    [https://wordpress.org/support/topic/not-keeping-no-follow](https://wordpress.org/support/topic/not-keeping-no-follow)
 * [https://wordpress.org/support/topic/empty-nofollow-button-in-the-add-a-link-frame-is](https://wordpress.org/support/topic/empty-nofollow-button-in-the-add-a-link-frame-is)
 * [https://wordpress.org/plugins/nofollow/](https://wordpress.org/plugins/nofollow/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Chad Hayton](https://wordpress.org/support/users/chadhayton/)
 * (@chadhayton)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/#post-7005168)
 * I should note that the code I found to be an issue on lines 234-234 is in the
   wplink.js file (not the minified one).
 *  [Luke Mlsna](https://wordpress.org/support/users/bitacre/)
 * (@bitacre)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/#post-7005530)
 * I’ll take a look at this, thank you.
 *  Thread Starter [Chad Hayton](https://wordpress.org/support/users/chadhayton/)
 * (@chadhayton)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/#post-8465319)
 * I just upgraded to v1.4.5 and realized that the issue I described above is still
   a problem. It looks like the code is unchanged, but it looks to me like my adjustment
   is what is needed to fix the problem.
 * Here is the only place I am seeing the variable ed set is in the open function
   where it is used to set the editor variable value:
 *     ```
       		open: function( editorId ) {
       			var ed;
   
       			$( document.body ).addClass( 'modal-open' );
   
       			wpLink.range = null;
   
       			if ( editorId ) {
       				window.wpActiveEditor = editorId;
       			}
   
       			if ( ! window.wpActiveEditor ) {
       				return;
       			}
   
       			this.textarea = $( '#' + window.wpActiveEditor ).get( 0 );
   
       			if ( typeof tinymce !== 'undefined' ) {
       				ed = tinymce.get( wpActiveEditor );
   
       				if ( ed && ! ed.isHidden() ) {
       					editor = ed;
       				} else {
       					editor = null;
       				}
   
       				if ( editor && tinymce.isIE ) {
       					editor.windowManager.bookmark = editor.selection.getBookmark();
       				}
       			}
   
       			if ( ! wpLink.isMCE() && document.selection ) {
       				this.textarea.focus();
       				this.range = document.selection.createRange();
       			}
   
       			inputs.wrap.show();
       			inputs.backdrop.show();
   
       			wpLink.refresh();
   
       			$( document ).trigger( 'wplink-open', inputs.wrap );
       		},
       ```
   
 * It is not used anywhere else in the code except in the location I have pointed
   to previously, and the “Open in a New Tab” checkbox directly above the offending
   line uses editor instead of ed:
 *     ```
       		mceRefresh: function() {
       			var text,
       				selectedNode = editor.selection.getNode(),
       				linkNode = editor.dom.getParent( selectedNode, 'a[href]' ),
       				onlyText = this.hasSelectedText( linkNode );
   
       			if ( linkNode ) {
       				text = linkNode.innerText || linkNode.textContent;
       				inputs.url.val( editor.dom.getAttrib( linkNode, 'href' ) );
       				inputs.openInNewTab.prop( 'checked', '_blank' === editor.dom.getAttrib( linkNode, 'target' ) );
       				// Set rel="nofollow" (mod)
       				inputs.relNofollow.prop('checked', "nofollow" === editor.dom.getAttrib(linkNode, 'rel' )); 
   
       				inputs.submit.val( wpLinkL10n.update );
       			} else {
       				text = editor.selection.getContent({ format: 'text' });
       				this.setDefaultValues();
       			}
   
       			if ( onlyText ) {
       				inputs.text.val( text || '' );
       				inputs.wrap.addClass( 'has-text-field' );
       			} else {
       				inputs.text.val( '' );
       				inputs.wrap.removeClass( 'has-text-field' );
       			}
       		},
       ```
   
 * When I change the code in my local copy everything works as expected. Any chance
   this can be pushed in to the next release?
 *  [Rick](https://wordpress.org/support/users/figurehead/)
 * (@figurehead)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/#post-8728925)
 * Is anyone still updating this plugin?
    I’m having the same issue…

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Not Keeping No Follow – Javascript Fix’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/nofollow_e3e3e3.svg)
 * [Ultimate Nofollow](https://wordpress.org/plugins/nofollow/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nofollow/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nofollow/)
 * [Active Topics](https://wordpress.org/support/plugin/nofollow/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nofollow/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nofollow/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Rick](https://wordpress.org/support/users/figurehead/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/not-keeping-no-follow-javascript-fix/#post-8728925)
 * Status: resolved