🌐
Stack Overflow
stackoverflow.com › questions › 64507691 › how-to-open-a-link-in-new-tab-in-json-file
How to open a link in new tab in JSON file - javascript
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Click me</button> </body> <script> var tipuesearch = {"pages": [ {"title": "My title", "text": "Description of my title", "tags": "tag1, tag2", "loc": "http://www.example.com/"} ]}; function myFunction() { const link=tipuesearch.pages[0].loc; window.open(link, '_blank'); }; </script> </html>
🌐
GitHub
github.com › openlink › structured-data-sniffer › issues › 9
JSON-LD link open the extension in a new tab · Issue #9 · openlink/structured-data-sniffer
September 9, 2017 - You switched accounts on another tab or window. Reload to refresh your session. ... I used the extension "OpenLink Structured Data Sniffer" (in version 2.15.2) on Google Chrome. 1/ Open the webpage https://psh.techlib.cz/skos/PSH13814 in Google Chrome 2/ Click on the link "Heslo ve formátu JSON-LD" (with your mouse) in left column 3/ A new tab is opened (and have focus) : chrome-extension://egdaiaihbdoiibopledjahjaihbmjhdj/page_panel.html?url=https://psh.techlib.cz/api/concepts/PSH13814?format=enriched&type=jsonld&ext= 4/ On the other browser tab, the json-ld in displayed but the extension don't work.
Author   Manu1400
Discussions

Javascript open in new tab by using json - Stack Overflow
if you want to open a new location after post success, then try these javascript methods window.location='url' loads a window into current tab and window.open(URL,name,specs,replace) open a new window. More on stackoverflow.com
🌐 stackoverflow.com
October 26, 2013
custom list - How Can I Get URL Column to Open in New Window in SharePoint 2016 - SharePoint Stack Exchange
I added the Site Column "URL" to my custom list. Now I need to have the link open in a new window. This is SharePoint 2016 so I can no longer use a calculated column to do this. Any ideas? More on sharepoint.stackexchange.com
🌐 sharepoint.stackexchange.com
Display json in a new browser tab page - javascript
I have been trying for 4 days to solve this problem. But I cannot return json data into a new tab page. My code: function CustomerId() { var url = "Home/ More on stackoverflow.com
🌐 stackoverflow.com
April 26, 2017
Open JSON links into new browser tabs?
... My goal is to have the JSON links ('Old Website', 'Illustration Site', etc.) open themselves in new browser tabs. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Themeco
theme.co › support
JSON / New Tab - Support - Themeco Forum
May 3, 2023 - Hi, i want to create a Button with the following params and wonder what do i need to add, so that the link opens in a new tab… “params” : { “text” : “Button Text”, “link” : “#”, }
🌐
Stack Overflow
stackoverflow.com › questions › 19605470 › javascript-open-in-new-tab-by-using-json
Javascript open in new tab by using json - Stack Overflow
October 26, 2013 - if you want to open a new location after post success, then try these javascript methods window.location='url' loads a window into current tab and window.open(URL,name,specs,replace) open a new window.
🌐
Attacomsian
attacomsian.com › blog › javascript-open-url-in-new-tab
Open a URL in a new tab or window on button click in JavaScript
October 12, 2022 - Here is an example that uses the Fetch API to make an AJAX call, and then open a new tab on a successful response: button.addEventListener('click', () => { // make an API call fetch('https://reqres.in/api/users') .then(res => res.json()) .then(json => { // fail in Chrome - popup blocked const tab = window.open('https://attacomsian.com', '_blank') }) })
🌐
Stack Exchange
sharepoint.stackexchange.com › questions › 269898 › how-can-i-get-url-column-to-open-in-new-window-in-sharepoint-2016
custom list - How Can I Get URL Column to Open in New Window in SharePoint 2016 - SharePoint Stack Exchange
Now I need to have the link open in a new window. This is SharePoint 2016 so I can no longer use a calculated column to do this. Any ideas? ... You can use JSON formatting for the column with target as _blank it will open.
🌐
Web Code Geeks
webcodegeeks.com › home › javascript
JavaScript: Open Link in New Tab - Web Code Geeks - 2025
April 24, 2020 - Chrome shows small icon in url bar when it refuses to open the new tab. User can click on it and allow popups manually. The easiest way to create a link that opens in a new tab is to add target="_blank" to it.
Find elsewhere
🌐
GitHub
github.com › yubaoquan › open-link-in-new-page › blob › master › manifest.json
open-link-in-new-page/manifest.json at master · yubaoquan/open-link-in-new-page
September 9, 2017 - "name": "All links open in new tab", "version": "1.0", "manifest_version": 2, "description": "Click on this extension's button in popup panel, will add target=_blank to all links in current page.", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "permissions": [ "tabs", "storage" ], "content_scripts": [ { "matches": [ "http://*/*", "https://*/*" ], ·
Author   yubaoquan
Top answer
1 of 4
1

Hello Philipp

Welcome to the Microsoft Community.

This is not a bug but a result of how the Edge JSON Viewer behaves when opening a URL programmatically via window.open. Here's an explanation of what's happening and how you can address the issue:

Explanation:

  1. Manual URL Entry:
    • When you manually input the JSON URL in Edge's address bar, Edge knows it's serving JSON content and uses its built-in JSON Viewer to pretty-print it.
  2. window.open() Behavior:
    • When you use window.open() to programmatically open the URL, Edge does not automatically invoke its JSON Viewer. Instead, it treats the opened page as plain text or raw JSON, and the pretty-print functionality is not applied.
  3. Reason:
    • Edge's JSON Viewer may only be triggered when the request is a direct manual navigation or when the JSON content is properly formatted and served with the correct Content-Type (application/json) header, but window.open doesn't trigger the JSON Viewer in the same way.

Solutions:

  1. Manually Open the URL
  • The simplest workaround is to let the user click the JSON URL (e.g., Open JSON), which will behave like manual navigation and trigger the JSON Viewer.
  1. Open the JSON in a New Tab with Pretty Formatting
  • You can use a JavaScript library (e.g., JSON.stringify) to pretty-print the JSON content before displaying it in a new tab or window. Example:
      fetch("https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&hourly=temperature_2m")
          .then(response => response.json())
          .then(data => {
              const prettyJSON = JSON.stringify(data, null, 2); // Pretty printconst newWindow = window.open();
              newWindow.document.write(`
    ${prettyJSON}
    `); newWindow.document.close(); });
    This fetches the JSON data, formats it nicely, and displays it in a new window or tab using
     tags.
  1. Use an External JSON Viewer Tool
  • If you frequently need to pretty-print JSON, you can use tools like:
    • jsonviewer.stack.hu
    • jsonformatter.org
    • These tools can take raw JSON data and pretty-print it in a visually appealing manner.
    • Disclaimer: This is a non-Microsoft website. The page appears to be providing accurate and safe information. Watch out for ads on the site that may advertise products frequently classified as PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.

Summary:

  • The behavior you're seeing is by design and not a bug. To ensure JSON is always pretty-printed when using window.open, either fetch the data and format it programmatically (Solution 2) or let the user manually click a link (Solution 1).

Best Regards,

William.Y | Microsoft Community Support Specialist

2 of 4
0

Thanks, I implemented the change and and the users are now clicking on a simple link in the javascript/angular UI, if they decide to view the plain JSON data from the WebService and this is working fine. The JSONViewer is opening when clicking a simple link (was not opening when using window.open(...)).
Strange behaviour, thanks for the workaround, this did solve my problem.
Greetings
Philipp

🌐
Mozilla Bugzilla
bugzilla.mozilla.org › show_bug.cgi
1687437 - Clicking a link on the JSON view opens a new tab
For problems in the browser tab features or problems with the widget itself. ... This bug is publicly visible. ... When I visit a JSON document like https://api.github.com/ all clicks on a link opens a new tab.
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 5071260 › modern-json-list-view-formatting-attributes-stripp
Modern json list view formatting: attributes stripped out by Msft - Microsoft Q&A
April 22, 2020 - This leads to a strangely inconsistent user experience - from a view page list links open in a new tab; from a list web part, they don't. To work around that pointless limitation in the modern ui, you have to bypass the silly page router process by adding the data-interception=off attribute. But when I add that to the json I'm using to make a list look like something people might want to engage with, it gets removed.
🌐
Microsoft Community Hub
techcommunity.microsoft.com › microsoft community hub › communities › products › content management › sharepoint
Alter JSON code to disallow new tab to open | Microsoft Community Hub
Currently I have four "honeycombs" and each has a link to it's respective page. I do NOT want these to open in new tabs and yet they do...does anyone know how to alter the code to make sure that doesn't happen? Thank you in advance! ... { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "hideSelection": true, "hideColumnHeader": true, "rowFormatter": { "elmType": "div", "style": { "position": "absolute", "width": "150px", "height": "150px", "left": "=if(floor(@rowIndex/5) % 2 == 0 , @rowIndex % 5 * 150 + 'px' , @rowIndex % 5 * 150 + 75 + 'px' )", "top
🌐
W3Schools
w3schools.com › jsref › met_win_open.asp
Window open() Method
Using the opener property to return a reference to the window that created the new window:
🌐
PHPpot
phppot.com › javascript › javascript-how-to-open-url-in-new-tab
JavaScript – How to Open URL in New Tab - PHPpot
This method follows the below steps to open a URL in a new tab via JavaScript. Create an anchor tag <a> by using the createElement() function. Sets the href and the target properties with the reference of the link object instantiated in step 1.
🌐
Esri Community
community.esri.com › t5 › arcgis-web-appbuilder-questions › get-hyperlink-to-open-in-a-new-tab › td-p › 1076661
Get hyperlink to open in a new tab - Esri Community
July 8, 2021 - I've successfully created a hyperlink to some text in the 'Query' widget, using ESRI assistant and JSON, but in spite of my putting "target='_blank'" as part of the code, Web AppBuilder refuses to recognise it and switches location, rather than opening a new tab.
🌐
Mozilla Connect
connect.mozilla.org › t5 › ideas › make-urls-clickable-in-values-in-json-response › idi-p › 19205
Make urls clickable in values in JSON response - Mozilla Connect
May 9, 2023 - In many applications where regular click is supposed to already do something, it requires the user to ctrl+click to follow the link, so it doesn't interfere with normal clicks. Please implement that. Having a link behave *as if* it's clickable and then be not cickable, feels like someone did a very good but unfinished job. ... Ctrl+clicking it should follow the URL and open it. Probably best to do so in a new tab.
🌐
Team Treehouse
teamtreehouse.com › community › adding-webpage-links-to-a-json-file
Adding webpage links to a json file (Example) | Treehouse Community
February 10, 2016 - can you paste your AJAX so we can help you in better way ... ... Project.fetchAll = function() { if (localStorage.projectData) { Project.loadAll(JSON.parse(localStorage.projectData)); ProjectView.initIndexPage(); } else { $.get('data/projectData.json', function(data) { Project.loadAll(data); var dataString = JSON.stringify(data); localStorage.setItem('projectData', dataString); ProjectView.initIndexPage(); }); } };