JavaScript Mailto link open in new tab only if web mail client mailto link open in gmail,mailto link open outlook,mailto

I have a web page that creates a list of contacts and their email addresses. You have two options for the mailto link, (1) open it in the current window or (2) open it in a new tab/window.

I see potential drawbacks from both sides:

  • For web mail clients (e.g. gmail) option 1 is not ideal because it hijacks the window then, and the user must navigate back to the application in some fashion
  • For desktop mail clients, the first option is not ideal because now you have a blank window/tab left open

Is there anyway to "detect" if the opened webpage has content and close it if not?

Based on this link:

Detecting web-based mail client vs local mail client for a mailto link

I tried the following to get the body:

const windowRef = window.open(`mailto:${email}`, '_blank')
const body = windowRef.document.body

The problem I was running into was that the body of each document was empty: <body></body>

I assume this was because it didn't have enough time to load the page, so I attempted to setTimeout but then I got a Blocked a frame with origin "myhostman" from accessing a cross-origin frame.

Any ideas on a way to support both web and desktop mail clients without the drawbacks listed above?

Answer:1

I have an ajax success response from one html but I want to set dynamic data of this ajax response to another how do I do that here is my ajax report success: function(data) { console....

I have an ajax success response from one html but I want to set dynamic data of this ajax response to another how do I do that here is my ajax report success: function(data) { console....

I'm looking at a node.js library (gen-readlines) that reads large flat files via a generator - i.e. a file is read in 'chunks' of 65 536 bytes at a time via a generator. Not having a CS background I ...

I'm looking at a node.js library (gen-readlines) that reads large flat files via a generator - i.e. a file is read in 'chunks' of 65 536 bytes at a time via a generator. Not having a CS background I ...

I have an app that runs in the client browser and doesn't have any server side (http/js is served, but nothing posts to the server). the app is redeployed on many servers (iis, apache, nginx, ...

I have an app that runs in the client browser and doesn't have any server side (http/js is served, but nothing posts to the server). the app is redeployed on many servers (iis, apache, nginx, ...

I wrote a Fibonacci Sequence javascript solution. I was able to push out a Fibonacci Sequence array. However, this solution add an extra number in the array that is more than the limited number. For ...

I wrote a Fibonacci Sequence javascript solution. I was able to push out a Fibonacci Sequence array. However, this solution add an extra number in the array that is more than the limited number. For ...

  1. limit fibonacci sequence