WordPress.org

Ready to get started?Download WordPress

Forums

target = blank not working (4 posts)

  1. Lizbit
    Member
    Posted 5 years ago #

    Here is a link to my site

    I've edited the footer.php to include a link to a webstats provider I use. That went in fine (using Dreamweaver to insert the code).

    But - I want to go back and put in the target=blank so the stats open in a new window.

    In WP Dashboard, if I try editing footer.php it says the file is not writeable, but the permissions are set at 755. I am able to open and save changes using Dreamweaver but for some reason the target=blank isn't working.

    I went back in through Dashboard and I can see the code. But, it won't work!

    What am I overlooking? Why won't it open in a new window?

    Thank you!

  2. greg2008
    Member
    Posted 5 years ago #

    I edited your code and it worked fine for me.
    Not sure if you know, but you actually have TWO links to those stats

    1) The basic link for people with Javascript:

    <a href="http://new.addfreestats.com/?usr=00728172">
    </a>

    2) The no-script for people without Javascript
    <noscript> <a href="http://www.addfreestats.com" target="_blank" > <img src="http://www7.addfreestats.com/cgi-bin/connect.cgi?usr=00728172Pauto" border=0 alt="AddFreeStats.com Free Web Stats!">Web Stats</a> </noscript>

    You have added the target=blank ONLY to the no-script, for those without Javascript.
    So if you HAVE Javascript enabled in your browser then you are seeing the link 1) above WITHOUT the target=blank.
    SO you need to add that to both links.

    You can (and should really) test both links.. by having Javascript enabled in your browser, then disabled (refresh page after changing).
    Try disabling Javascript in your browser before editing any more code, the link will open in a new tab as you want. Just edit the other link, enable Javascript again refresh and you will be good to go!

    <a href="http://new.addfreestats.com/?usr=00728172" target="_blank">
    </a>
  3. Lizbit
    Member
    Posted 5 years ago #

    Hey Greg,

    Thanks for the response. I have edited the code to include target=blank in both scripts - but still, when I click on my adfreestats symbol in the footer, keeps using the same window.... can I trouble you to look again and see if I got the code correctly placed in both areas? Thanks much!

  4. greg2008
    Member
    Posted 5 years ago #

    No problem.

    You have put it in the script tag
    Here:
    <script target="_blank" src="http://www7.addfreestats.com/cgi-bin/afstrack.cgi?usr=00728172" type="text/javascript">

    So remove the target="_blank" from that tag (as above) and add it to the <a href just underneath that
    Here:
    <a href="http://new.addfreestats.com/?usr=00728172">

    A <a href=""> is a link, and it's the links you assign the target blank to so the link opens in a new tab (or page).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.