WordPress.org

Ready to get started?Download WordPress

Forums

Open in New Window Plugin
Mods to make files (pdf) open in new window (2 posts)

  1. adellafave
    Member
    Posted 2 years ago #

    fyi...the plugin didn't seem to be working for PDFs on my site. I wanted them, as well as external links, to open in a new window. I made the following modifications to the files to get it working:

    open_in_new_window.php
    var kpg_oinw_list=[".pdf",".mp3",".jpg",".gif",".tiff",".png",".doc",".rtf",".docx",".xls",".wmv",".mov",".avi",".zip",".rar",".7z",".arc"];

    open_in_new_window.js

    // check to see if target is on this domain.
    							if (b[i].hostname && location.hostname) {
    								if (b[i].hostname.toLowerCase() != location.hostname.toLowerCase()) {
    									b[i].target="_blank";
    								} else if (kpg_oinw_checktypes) {
    								// list of types to check here
    									for (k=0;k<kpg_oinw_list.length;k++) {
    										if (khref.indexOf(kpg_oinw_list[k])!=-1) {
    											b[i].target="_blank";
    										}
    									}
    								}
    							} else if (khref.indexOf(ksrv)==-1) {
    								b[i].target="_blank";
    							}

    http://wordpress.org/extend/plugins/open-in-new-window-plugin/

  2. kpgraham
    Member
    Plugin Author

    Posted 2 years ago #

    I thought that is what I was doing. I'll have to check what it is that I screwed up.

    Thanks for the update,

    Keith

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic