Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

cannot open a link in forge via right click when trying left click open on new tab it works

Ankit kharola January 8, 2025

I ave created a forge app which uses react to display issues in a table and i have added links to certain fields but when trying to open them using right click it gives an error 

 

Blocked opening 'https://forge-learning1.atlassian.net/browse/FL-103' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

 

 

<td style={styles.commentCell}>
                  {comment.commentText ? (
                    <a
                      href={`${baseUrl}/browse/${issue.issueKey}/comment/${comment.commentId}`}
                      style={styles.commentLink}
                      target="_blank"
                      rel="noopener noreferrer"
                    >
                      {comment.commentText}
                    </a>
                  ) : (
                    'No Comment'
                  )}
                </td>

1 answer

1 accepted

4 votes
Answer accepted
Akash Singh
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025

Hi @Ankit kharola 

The error you're encountering happens because Forge apps run in a sandboxed iframe environment, which has strict security settings. By default, the iframe sandbox prevents popups unless the allow-popups attribute is explicitly set, which isn't allowed in Forge apps for security reasons.

To solve this, instead of opening links directly with standard HTML anchor tags, you can use the Forge Bridge API's router.navigate function. This function allows you to programmatically navigate within the Atlassian product without violating the sandbox's restrictions.

Here’s the link to the documentation for router.navigate:
Forge Bridge Router API

Example usage:

import { router } from '@forge/bridge'; 

const handleLinkClick = (issueKey) => {
router.navigate(`/browse/${issueKey}`);
};

I would highly recommend checking out the Atlassian Developer Community for more in-depth discussions and support on Forge app development. You can post questions or browse existing solutions there: Atlassian Developer Community 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events