mrlevitas
mrlevitas

Reputation: 80

HTML "mailto:" not opening in new window

This is my first post. I am trying to create a mailto link using 'templated' Javascript that takes the following excerpt from a JSON object:

var menu = {
"menu": [
     {
     "title": "let's talk",
     "link": "mailto:[email protected]"
      }
   ]
}

Where '+menu.menu[i].link+' is replaced by "mailto:[email protected]"

for (i=0; i<menu.menu.length; i=i+1) {
     entry = '<li><a href="'+menu.menu[i].link+'">'+menu.menu[i].title+' </a></li>';
}
$("#navmenu:last").append(entry);

When I click on the page (http://mrlevitas.github.io), nothing happens in either chrome or firefox.

Any advice please?

Upvotes: 1

Views: 268

Answers (2)

bSaraogi
bSaraogi

Reputation: 148

It is browser settings specific, ie. it will behave differently depending on the user's browser settings. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers or Chrome Settings->Content Settings->Manage Handlers...

Possibly read this

Upvotes: 1

Chilion
Chilion

Reputation: 4500

You might want to use the

for (i=0; i<menu.menu.length; i=i+1) {
 entry = '<li><a href="'+menu.menu[i].link+'"  target="_BLANK">'+menu.menu[i].title+' </a></li>';
}
$("#navmenu:last").append(entry);

It opens a new window.

Upvotes: 1

Related Questions