On mobile, links to Google Maps opens the app, and leaves the user on about:blank page in browser

Iโ€™m looking for help for my app that is deployed on Community Cloud here:

In my app, Iโ€™ve added Google Maps links that the user can follow. On computer it works as intended, however on phone, the link opens the Google Maps app (if the user has it installed) and when the user navigates back to Google Chrome a new about:blank tab has been opened. Now the user needs to close this tab and find the Streamlit Appโ€™s tab, in order to continue.

Can I do anything to mitigate the opening of about:blank ?

Hello @Rasmus_Sorensen,

There are a few strategies you can consider to mitigate this issue:

  1. Ensure that your links to Google Maps are using target="_self" . This tells the browser to open the link in the same tab.
<a href="https://www.google.com/maps/place/..." target="_self">Open in Google Maps</a>
  1. You can try a JavaScript-based solution to handle the opening of links.
document.getElementById("your-link-id").addEventListener("click", function(event){
    event.preventDefault();
    window.location.href = this.href;
});
  1. Sometimes the simplest solution is to inform users about what to expect :slight_smile: You could add a small note or tooltip near your Google Maps links explaining that they might need to navigate back to the previous tab after using Google Maps.

Let me know if you might require any further assistance!

Kind Regards,
Sahir

P.S. Lets connect on LinkedIn!

2 Likes