16

JavaScript mailto using the open window

 2 years ago
source link: https://www.codesd.com/item/javascript-mailto-using-the-open-window.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

JavaScript mailto using the open window

advertisements

I currently have a form set up with 5 radio options. I have a switch statement depending on the option you pick and that determines where the email is going to go.

Inside my switch, I have this piece of code.

window.open("mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody);

It all works fine when it opens up my email client with all of the content however it also opens a blank page in the browser.

Is there another way to achieve this or prevent a blank window from opening but still make it as if you clicked on the href:mailto ?


Instead of:

window.open("mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody);

You can try:

location.href = "mailto:"+emailTo+'?cc='+emailCC+'&subject='+emailSub+'&body='+emailBody;

Tags javascript

Related Articles

How to close the tab without using the open window

I use the following to open new tab (in new process) with some page content, var p = document.getElementById("myElement"); var a = document.createElement('a'); a.setAttribute('href',".../mypage.html"); a.setAttribute('rel',"norefe

Error while using the Open Graph Facebook API when connecting

How do you use the open graph API to display a facebook login button, and get the username and email after a successful login? I've tried this but with no success. I have this in the head section: <script src="http://connect.facebook.net/en_US/all

Write a code to find the opening windows on the desktop

Is there anyway to find what kind of window is opened on the desktop in real time? It may need C# or C++. What I have found right now is to use C# Process.GetProcesses() method to find the opened windows on desktop. But the output cannot be changed w

How can I enumerate the open windows (~ EnumWindows) of another user session

I have an application that can list the opened windows of the current session. It uses the EnumWindows method from the user32.dll. I would like to run this code from a windows service, but as the service is not attached to a user session, it returns

Using the usual Windows Print dialog box instead of the Java dialog box

How can I use the standard Windows Print dialog to print instead of the Java Dialog. I got problems printing a barcode with a label-printer. When I print via the Java-Print Dialog I get an error telling me that the format of the document which I want

How to increment a value in a text file using the standard Windows command line?

I'd like to keep a "compile-counter" for one of my projects. I figured a quick and dirty way to do this would be to keep a text file with a plain number in it, and then simply call upon a small script to increment this each time I compile. How w

How can I specify that a Word TableCell should not be returned using the Open XML SDK?

I'm generating a simple Word (docx) document using the Open XML SDK. One think I'm struggling with is how to stop table cell contents from wrapping. Here's my code for generating a table cell: private TableCell CreateTableCell(string text, int paddin

run an oracle stored procedure from the sql server by using the open query function

Can you confirm if you have successfully executed an oracle stored procedure from sql server using the open query function. If yes, How? because I am having problems executing stored procedures with arguments using the OPENQUERY Function.Finally trac

Advantage of using the prefix 'window' in javascript

Are there any benefits to using the 'window' prefix when calling javascript variables or methods in the window object? For example, would calling 'window.alert' have an advantage over simply calling 'alert'? I can imagine using the prefix could give

How to keep the focus on the open window using & ldquo; window.Open & ldquo; after the page load of the parent page?

I am working on an application. I have opened a Window using window.open() Now after opening this window, the parent Page is getting Refreshed(Means Page Load is Happening). Now , How can I set the Focus on the Child Window after the Page load of the

Iframe / Popup redirection of the opening window

I have a page located at x.com. On this page is a button that, when clicked, will launch a new window (using javascript's window.open() method) to a page that is located at z.com. The popup does a few things, then redirects the original window (the o

Javascript window.print () in chrome, closing a new window or tab instead of canceling printing leaves javascript blocked in the parent window

In the application I work on, we have several different places a user can print from. In all these cases we are using the same workflow of opening a new window(or tab), writing whatever we need to print to the document of the new window, and then we

Using the Command Window in Visual Studio

I'm trying to follow this walk-through: Hosting a WCF in a Windows Service Up to this step: Step 6: Install the Windows Service In this step, you install the Windows service and run it from the Services console. Rebuild the solution and open a Visual

Changing the address of the opening window in IE8

From a child popup window (opened using window.open), I am trying to change the URL of the window that opened me, e.g. window.opener.location.href = 'http://www.google.com'; In all browsers this works wonderfully, except for IE8 (and I am somewhat su

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK