WordPress.org

Ready to get started?Download WordPress

Forums

Open link in new window by default (7 posts)

  1. aar0on
    Member
    Posted 7 years ago #

    When I'm writing a new post and click the button to add a link to my text, it always defaults to 'Open in same window'. I'd like to change this to default to opening in a new window, so it's really just a matter of reversing these two options.

  2. aar0on
    Member
    Posted 7 years ago #

    I ended up going to wp-includes/js/tinymce/themes/advanced/link.htm and finding the following lines:

    <option value="_blank">{$lang_insert_link_target_blank}</option>

    AND

    <option value="_self">{$lang_insert_link_target_same}</option>

    and I switched the 'blank' and 'same' sections of each line, essentially switching the order in which they appear.

    Simple and it worked.

  3. aar0on
    Member
    Posted 7 years ago #


  4. altoyes
    Member
    Posted 7 years ago #

    aar0on:
    thats cool
    i wanted to know that too

    do you know how to give the new window attributes, like window size, position, etc

    and even better, how to set a default window attributes?

    alto

  5. aar0on
    Member
    Posted 7 years ago #

    Actually, scratch what I just said in that last post. Here's the PROPER way to do it:

    Open wp-includes/js/tinymce/themes/advanced/link.htm and finding the following lines:

    <option value="_self">{$lang_insert_link_target_same}</option>

    AND

    <option value="_blank">{$lang_insert_link_target_blank}</option>

    ***All you have to do is switch them in their order, so they should look like this:

    <option value="_blank">{$lang_insert_link_target_blank}</option>

    <option value="_self">{$lang_insert_link_target_same}</option>

    That's it!

    Another thing I did was go to wp-includes/js/tinymce/themes/advanced/jscripts/link.js and opened it in Notepad. Find line:

    href.value = tinyMCE.getWindowArg('href') || 'http://';

    and change it to:

    href.value = tinyMCE.getWindowArg('href') || '';

    Now you won't have to highlight the http:// before you paste a link.

  6. deliot
    Member
    Posted 6 years ago #

    Another way to make "Open Link in a NEW Window" the default is to edit the line:

    from:
    <option value="_blank">

    to:
    <option value="_blank" selected="selected">

    So "_blank" now becomes the SELECTED default for the drop down list. Same as what aar0on said, only without changing the order of the options.

  7. karels74
    Member
    Posted 6 years ago #

    Hi, I consider deliot version cleaner ... have posted about it.

Topic Closed

This topic has been closed to new replies.

About this Topic