WordPress.org

Forums

Link opening in new tab with no target="_blank"...Why?? (9 posts)

  1. hlmijendrix
    Member
    Posted 1 year ago #

    Hi everyone,

    I'm having a bit of an issue with a site I'm administering. On one of the side nav bars, I have a a few links set up to go to different pages. Here's the code:

    <div id="rightnav">
    	<ul>
    		<li><a href="/1-bedroom-photo-gallery" target="_self" title="1 Bedroom Apartments">1 BEDROOM</a></li>
    		<li><a href="/2-bedroom-photo-gallery" title="2 Bedroom Apartments">2 BEDROOM</a></li>
    		<li><a href="/3-bedroom-photo-gallery" title="3 Bedroom Apartments">3 BEDROOM</a></li>
    		<li><a href="/homes/floor-plans/">FLOOR PLANS</a></li>
    	</ul>
    </div>

    Whenever one of the links are clicked though, the window opens in a new tab. Any idea why? I'd like for it to remain in the same window. Thanks for the help.

  2. newsdevice
    Member
    Posted 1 year ago #

    Does this also occur when using a different browser?

    Also, I would suggest disabling any plugins and test the issue with the default WP theme.

    ps: targeting target="_self" is not really necessary, as that is the default action for links.

  3. hlmijendrix
    Member
    Posted 1 year ago #

    I can't really go about disabling plugins as this is a live site. I've tried the site in Firefox, Chrome, and IE9...all have the issue. The _self piece of code was merely a test out of desperation hehe.

    Anyone have any ideas?

  4. newsdevice
    Member
    Posted 1 year ago #

    Well, if you cannot disable plugins (live site) then at least give a link to the site, then you really should have a sandbox to test out issues or go through the list of plugins you have active and make sure they updated and do not have some form of link modification.

    Does the theme/menu have an option to open links in new windows? Do any plugins have that option?

    You code is correct, that's about as basic an HTML markup as it gets.

  5. hlmijendrix
    Member
    Posted 1 year ago #

    `http://5800third.com/homes/photo-gallery/' is the link to the site. The extra window pops up when a link is clicked on the right side. I deactivated plug-ins very quickly on the site, refreshed the page, tested, then reactivated it..for all of the plugins. None of them were causing the issue.

  6. newsdevice
    Member
    Posted 1 year ago #

    I just took a quick peek and noticed that all the links with a title ref do popup into a new window. While the one without (Floor Plans) does not. Will you please remove the title ref in the other links to see if the lightbox is interfering with your non-image links?

  7. hlmijendrix
    Member
    Posted 1 year ago #

    Hi Newsdevice,

    I removed them and they're still opening in a new tab.

  8. newsdevice
    Member
    Posted 1 year ago #

    Well, in order to solve the problem, it will take some good old fashioned bug hunting.

    Looking at the theme (backend), going through the plugins and eliminating them individually as the issue, verify they are not conflicting with one another (or the theme), etc.

  9. hlmijendrix
    Member
    Posted 1 year ago #

    Bug hunting is what was needed...and bug hunting is what I did.

    After looking at the code a bit more, I saw the following piece of code in the header...

    //Open PDFs in new window
    				jQuery("a[href*=bedroom]").click(function(){
    					window.open(this.href);
    					return false;
    				});
    			});

    The last web developer integrated that into the site so that the floor plan .pdf's would open in a new window. It would look at the link and open a new window for any link that had 'bedroom' in the anchor text. I tried changing it to a[href*=.pdf], but it doesn't take the file extension into account apparently.

    Stress levels are officially reduced!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.