As I work on developing a new website that utilizes a MySQL database to sort various items into categories and subcategories, I have implemented a script that dynamically loads category content into a div without requiring a page reload. This seamless loading also updates the URL in the browser's address bar, ensuring that refreshing the page will display the correct category content. However, I am facing an issue with enabling the "open in new tab" functionality when right-clicking, as the content is loaded through a JavaScript/AJAX function.
In my attempt to resolve this, I tried using:
<a href="javascript: liveresults('mycategory');">
in place of:
<a onclick="liveresults('mycategory');">
Unfortunately, this approach does not trigger the "open in new tab" option in Firefox and leads to an "about:blank" page in Chrome. While holding CTRL and clicking in Firefox allows the functionality to work, it modifies the URL to "javascript:%20liveresults('mycategory');" which presents a challenge for users.
If anyone has suggestions on how to tackle this issue, such as potentially creating a custom right-click menu similar to , I would greatly appreciate any insights or guidance.