{"id":6153,"date":"2025-05-06T13:42:59","date_gmt":"2025-05-06T11:42:59","guid":{"rendered":"https:\/\/www.open-user-map.com\/?post_type=ht_kb&#038;p=6153"},"modified":"2025-05-06T13:42:59","modified_gmt":"2025-05-06T11:42:59","slug":"open-a-link-custom-field-in-a-new-tab","status":"publish","type":"ht_kb","link":"https:\/\/www.open-user-map.com\/fr\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/","title":{"rendered":"Ouvrir un champ personnalis\u00e9 dans un nouvel onglet"},"content":{"rendered":"<p>Si vous utilisez un champ personnalis\u00e9 de type <strong>\"Lien\"<\/strong> et que vous souhaitez que le lien s'ouvre toujours dans une fen\u00eatre <strong>nouvel onglet du navigateur<\/strong>vous pouvez ajouter un petit extrait de JavaScript \u00e0 votre site.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#f6f6f4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\" data-no-auto-translation=\"\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#333545;color:#ebebe6\">JavaScript<\/span><pre class=\"shiki dracula-soft\" style=\"background-color: #282A36\" tabindex=\"0\"><code data-no-translation=\"\" data-no-auto-translation=\"\"><span class=\"line\"><span style=\"color: #F6F6F4\">document.body.<\/span><span style=\"color: #62E884\">addEventListener<\/span><span style=\"color: #F6F6F4\">(<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #E7EE98\">click<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #F6F6F4\">, <\/span><span style=\"color: #F286C4\">function<\/span><span style=\"color: #F6F6F4\"> (<\/span><span style=\"color: #FFB86C; font-style: italic\">e<\/span><span style=\"color: #F6F6F4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">  <\/span><span style=\"color: #F286C4\">const<\/span><span style=\"color: #F6F6F4\"> link <\/span><span style=\"color: #F286C4\">=<\/span><span style=\"color: #F6F6F4\"> e.target.<\/span><span style=\"color: #62E884\">closest<\/span><span style=\"color: #F6F6F4\">(<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #E7EE98\">.oum_location_custom_fields a<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #F6F6F4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">  <\/span><span style=\"color: #F286C4\">if<\/span><span style=\"color: #F6F6F4\"> (link <\/span><span style=\"color: #F286C4\">&amp;&amp;<\/span><span style=\"color: #F6F6F4\"> <\/span><span style=\"color: #F286C4\">!<\/span><span style=\"color: #F6F6F4\">link.target) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">    e.<\/span><span style=\"color: #62E884\">preventDefault<\/span><span style=\"color: #F6F6F4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">    window.<\/span><span style=\"color: #62E884\">open<\/span><span style=\"color: #F6F6F4\">(link.href, <\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #E7EE98\">_blank<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #F6F6F4\">, <\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #E7EE98\">noopener<\/span><span style=\"color: #DEE492\">&#39;<\/span><span style=\"color: #F6F6F4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F6F6F4\">});<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Vous pouvez ajouter ce snippet sous <em>Ouvrez la carte de l'utilisateur &gt; Param\u00e8tres &gt; Avanc\u00e9s &gt; JS personnalis\u00e9<\/em>.<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Si vous utilisez un champ personnalis\u00e9 de type \"Lien\" et que vous souhaitez que le lien s'ouvre toujours dans un nouvel onglet du navigateur, vous pouvez ajouter un petit extrait JavaScript \u00e0 votre site. Vous pouvez ajouter cet extrait sous Open User Map &gt; Param\u00e8tres &gt; Avanc\u00e9s &gt; JS personnalis\u00e9.<\/p>","protected":false},"author":50,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[25],"ht-kb-tag":[58,27,74,165],"class_list":["post-6153","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-customization","ht_kb_tag-custom","ht_kb_tag-custom-fields","ht_kb_tag-js","ht_kb_tag-link"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Open a Link Custom Field in a New Tab - Open User Map<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.open-user-map.com\/fr\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Open a Link Custom Field in a New Tab - Open User Map\" \/>\n<meta property=\"og:description\" content=\"If you&#8217;re using a custom field of type &#8220;Link&#8221; and want the link to always open in a new browser tab, you can add a small JavaScript snippet to your site. You can add this snippet under Open User Map &gt; Settings &gt; Advanced &gt; Custom JS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.open-user-map.com\/fr\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\" \/>\n<meta property=\"og:site_name\" content=\"Open User Map\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\"},\"author\":{\"name\":\"Daniel Sch\u00f6nherr\",\"@id\":\"https:\/\/www.open-user-map.com\/#\/schema\/person\/d9c8cbe470ae2702b6de61e0f73a7402\"},\"headline\":\"Open a Link Custom Field in a New Tab\",\"datePublished\":\"2025-05-06T11:42:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\"},\"wordCount\":54,\"publisher\":{\"@id\":\"https:\/\/www.open-user-map.com\/#organization\"},\"inLanguage\":\"fr-FR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\",\"url\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\",\"name\":\"Open a Link Custom Field in a New Tab - Open User Map\",\"isPartOf\":{\"@id\":\"https:\/\/www.open-user-map.com\/#website\"},\"datePublished\":\"2025-05-06T11:42:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.open-user-map.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Open a Link Custom Field in a New Tab\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.open-user-map.com\/#website\",\"url\":\"https:\/\/www.open-user-map.com\/\",\"name\":\"Open User Map\",\"description\":\"WordPress Map Plugin\",\"publisher\":{\"@id\":\"https:\/\/www.open-user-map.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.open-user-map.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.open-user-map.com\/#organization\",\"name\":\"Open User Map\",\"url\":\"https:\/\/www.open-user-map.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.open-user-map.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.open-user-map.com\/wp-content\/uploads\/2023\/09\/icon-256x256-1.png\",\"contentUrl\":\"https:\/\/www.open-user-map.com\/wp-content\/uploads\/2023\/09\/icon-256x256-1.png\",\"width\":256,\"height\":256,\"caption\":\"Open User Map\"},\"image\":{\"@id\":\"https:\/\/www.open-user-map.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.open-user-map.com\/#\/schema\/person\/d9c8cbe470ae2702b6de61e0f73a7402\",\"name\":\"Daniel Sch\u00f6nherr\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ouvrir un champ personnalis\u00e9 dans un nouvel onglet - Open User Map","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.open-user-map.com\/fr\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/","og_locale":"fr_FR","og_type":"article","og_title":"Open a Link Custom Field in a New Tab - Open User Map","og_description":"If you&#8217;re using a custom field of type &#8220;Link&#8221; and want the link to always open in a new browser tab, you can add a small JavaScript snippet to your site. You can add this snippet under Open User Map > Settings > Advanced > Custom JS.","og_url":"https:\/\/www.open-user-map.com\/fr\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/","og_site_name":"Open User Map","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#article","isPartOf":{"@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/"},"author":{"name":"Daniel Sch\u00f6nherr","@id":"https:\/\/www.open-user-map.com\/#\/schema\/person\/d9c8cbe470ae2702b6de61e0f73a7402"},"headline":"Open a Link Custom Field in a New Tab","datePublished":"2025-05-06T11:42:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/"},"wordCount":54,"publisher":{"@id":"https:\/\/www.open-user-map.com\/#organization"},"inLanguage":"fr-FR"},{"@type":"WebPage","@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/","url":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/","name":"Ouvrir un champ personnalis\u00e9 dans un nouvel onglet - Open User Map","isPartOf":{"@id":"https:\/\/www.open-user-map.com\/#website"},"datePublished":"2025-05-06T11:42:59+00:00","breadcrumb":{"@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.open-user-map.com\/knowledge-base\/open-a-link-custom-field-in-a-new-tab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.open-user-map.com\/"},{"@type":"ListItem","position":2,"name":"Open a Link Custom Field in a New Tab"}]},{"@type":"WebSite","@id":"https:\/\/www.open-user-map.com\/#website","url":"https:\/\/www.open-user-map.com\/","name":"Open User Map","description":"Plugin WordPress Map","publisher":{"@id":"https:\/\/www.open-user-map.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.open-user-map.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/www.open-user-map.com\/#organization","name":"Open User Map","url":"https:\/\/www.open-user-map.com\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.open-user-map.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.open-user-map.com\/wp-content\/uploads\/2023\/09\/icon-256x256-1.png","contentUrl":"https:\/\/www.open-user-map.com\/wp-content\/uploads\/2023\/09\/icon-256x256-1.png","width":256,"height":256,"caption":"Open User Map"},"image":{"@id":"https:\/\/www.open-user-map.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.open-user-map.com\/#\/schema\/person\/d9c8cbe470ae2702b6de61e0f73a7402","name":"Daniel Sch\u00f6nherr"}]}},"_links":{"self":[{"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb\/6153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/comments?post=6153"}],"version-history":[{"count":1,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb\/6153\/revisions"}],"predecessor-version":[{"id":6154,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb\/6153\/revisions\/6154"}],"wp:attachment":[{"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/media?parent=6153"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb-category?post=6153"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.open-user-map.com\/fr\/wp-json\/wp\/v2\/ht-kb-tag?post=6153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}