Results 1 to 6 of 6

Thread: Using "Open offsite links in new window" with other javascript

  1. #1
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using "Open offsite links in new window" with other javascript

    I've been using this Dynamic Drive script for a while now without any issues.

    I recently added a plugin to my Wordpress installation that allows me to bookmark posts on-site using javascript. The link to bookmark is as follows:

    PHP Code:
    <a title="Bookmark this post" href="javascript:addFavorites('<?php the_title(); ?>','<?php the_permalink() ?>');">Bookmark</a>
    When the "open links in new window' box is checked, the bookmark javascript still works fine in Safari, sliding down a confirmation box to bookmark the post. But in Firefox, when the new window box is checked, and I try to bookmark a post with the link above, it opens a new blank window and does nothing with the bookmark script.

    Is there any way to include that javascript:addFavorites to new_window.js' excluded domains list so that those links don't open in a new window/tab in Firefox? Or is there another way I might be able to fix this issue?

    Thanks in advance

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Which "open links in new window" script on DD are you experiencing this conflict with? Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Or this would probably work, without needing to alter the new window script:

    PHP Code:
    <a title="Bookmark this post" href="<?php the_permalink() ?>
    onclick="addFavorites('<?php the_title(); ?>','<?php the_permalink() ?>');return false;">Bookmark</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, I included the link on the text for "Dynamic Drive script" but should have typed it in plain text. Here's the one I'm referring to:

    Script: Open offsite links in new window
    http://www.dynamicdrive.com/dynamici...newwindow2.htm

    jscheuer1, I gave the ;return false; a try and that didn't work. Was able to test the conflict in IE last night, and it's the same as Firefox (javascript opens in new window). Safari is still the only one that works.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Look at my post again. There is more to it than just adding return false. The href has been changed as well, and the event has been hard coded to the onclick, rather than being in the href. Basically, what you need to do is give the link an href value that will not be seen as off site. I am assuming that the value:

    PHP Code:
    <?php the_permalink() ?>
    I used there would do so. You could also just make it to the root of the domain, as long as you have that excluded in the new windows script. But you probably did other things differently than what I had in my post, because with an onclick event and return false, the link shouldn't fire at all.

    Did you setup the domain here:

    Code:
    excludedomains: ["dynamicdrive.com", "google.com"]
    ?

    Or, you could forget about using a link at all:

    PHP Code:
    <span title="Bookmark this post"
    onclick="addFavorites('<?php the_title(); ?>','<?php the_permalink() ?>');">Bookmark</span>
    That way, at least the link wouldn't be the issue. If there is still a problem after that, there is something else wrong.

    What script are you using for the bookmark?

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I apologize jscheuer1. I was in a rush and didn't notice your initial changes made to my link code. I now copied and pasted it as you wrote it and it works like a charm in all browsers.

    A huge thanks to you, and again, sorry for making you type all you did in your last reply -- your first solution did the trick.

    Thanks a ton

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •