Chrome中的Mailto链接会打开新标签页

时间:2015-12-22 10:30:43

标签: google-chrome mailto

您好我的页面上有mailto链接,在其他broswers中工作正常。在chrome中,它会打开一个新的选项卡,其中包含mailto链接作为URL。有没有办法抑制Web开发人员的行为?

从我读过的内容来看,这似乎是Chrome设置的一个功能,但我想知道是否有人有解决方法。

编辑:网站位于这里nickstestserver.com/phi-rhos-near-you这是一个drupal 7网站。这是相关的html。

enum Gender {

    Boy, Girl, Other;
}

enum Course {

    IT, CS;
}

class Student {

    final String name;
    final int age;
    final Gender gender;
    Course course;

    public Student(String name, int age, Gender gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    @Override
    public String toString() {
        return name + "\t" + age + "\t" + gender + "\t" + course + "\n";
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Student other = (Student) obj;
        if (!Objects.equals(this.name, other.name)) {
            return false;
        }
        if (this.age != other.age) {
            return false;
        }
        if (this.gender != other.gender) {
            return false;
        }
        return true;
    }

}

public void test() {
    System.out.println("Hello");
    List<Student> students = Arrays.asList(
            new Student("A", 9, Gender.Boy),
            new Student("B", 10, Gender.Boy),
            new Student("B", 9, Gender.Boy),
            new Student("A", 9, Gender.Boy),
            new Student("A", 9, Gender.Girl)
    );
    // Fold it into a Set to eliminate duplicates.
    Set all = new HashSet();
    all.addAll(students);
    // Pull back out into a List.
    System.out.println("Students:\n" + all);
}

2 个答案:

答案 0 :(得分:7)

因此,从URL中删除“target = _blank”会停止该行为。

答案 1 :(得分:0)

这是因为您没有在该浏览器中设置默认邮件,因此浏览器将您的链接视为页面复制并粘贴到新的浏览器窗口中,以获取有关如何设置默认邮件的说明。

以下是4种最常见的网络浏览器的网址

Internet Explorer https://support.microsoft.com/en-us/help/555566

Firefox https://support.mozilla.org/en-US/kb/change-program-used-open-email-links

Google Chrome https://support.google.com/chrome/forum/AAAAP1KN0B0oxPLcXhbt9w?hl=en

Safari https://support.apple.com/en-us/HT201607