Large mailto links do not open in Chrome [duplicate] - javascript

This question already has an answer here:
mailto not working with large body content
(1 answer)
Closed 2 years ago.
I have a javascript script where I dynamically change the href attribute and trigger the click event.
var href = 'mailto:custom#outlook.com?subject=TestSubject&body=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
var element = document.getElementById('mail-link');
element.setAttribute('href', href);
element.click();
However, the above script appears to do nothing in Google Chrome. On the other hand, it works perfectly fine on Mozilla Firefox where the result is that it opens the default mail client with the appropriate mail recipient, subject and body.
I have also noticed that if I change the href to a shorter value, then Google Chrome manages to open the mail client.
var href = 'mailto:custom#outlook.com?subject=TestSubject&body=aaaaaaaa';
Is it possible to have Google Chrome open large mailto links?

I'm pretty sure that body text is not intended to be the first field of the message. Its intended for short text messages, not long bodies that you're used to seeing like... long bodies of text.
Check this out.

Have a look at how to get around chrome mailto maxlength limit. A suggestion there was to simulate a mail client to omit the issue.

Related

How to hide refferer from a website [duplicate]

This question already has answers here:
Remove http referer
(10 answers)
Closed 6 years ago.
For example I have a website X and I don't want the other site Y, to know my url adress if someone goes to site Y through my website X. How do I do that?
There is noreferrer value for rel attribute:
https://html.spec.whatwg.org/multipage/semantics.html#link-type-noreferrer
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
Prevents the browser, when navigating to another page, to send this page name, or any other value, as referrer via the Referer: HTTP header.
(In Firefox, before Firefox 37, this worked only in links found in pages. Links clicked in the UI, like "Open in a new tab" via the contextual menu, ignored this).
Example:
example
There is also a library that tries to support noreferrer on older/non-supportive browsers:
https://github.com/knu/noreferrer

Problems decoding url with decodeURIComponent if it has a href in it

I have to decode response message from external web site (so, it's not possible to change the way they return messages), but it does not work in Fancybox modular pop-up where this page is loaded.
I'm using in such way (it works fine when page loads as "simple page", but not - when open this page using Fancybox jQyery plugin):
var response = JSON.parse(decodeURIComponent(h.url.param.get("response")));
the response looks like this:
response={%22Message%22%3a%22response+message+%3Ca+href%3d%27http%3a%2f%2fwww.linktosomeurl.com%27+target%3d%27_blank%27%3Eclick+here.%3C%2fa%3E%22}
it should return "message click here" (and click here is as link to www.linktosomeurl.com)!
as I said - it works fine when just open page. But the problem is that it does not get response message if open the page in fancybox (somehow fancybox jQuery breaks this response message because of the a href url inside it).
is there a way how I can get this response message with url also using Fancybox?
Any hint about the problem would be appreciated...really stuck with this ;-(
Try
var res = "?response={%22Message%22%3a%22response+message+%3Ca+href%3d%27http%3a%2f%2fwww.linktosomeurl.com%27+target%3d%27_blank%27%3Eclick+here.%3C%2fa%3E%22}";
var response = $.parseHTML(decodeURIComponent(res.split(/\=\{|\}/)[1]).replace(/response|message|\+/gi," "))[1];
$("body").append(response)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
so far not find the solution, but used workaround, more flexible than answered before - asked external site owners to change response message use link as plain text, and at my side change plain text link to a href link as described here:
How to replace plain URLs with links?
so far works fine! Not real solution, but quite good workaround to save time...
thanks for hints, suggestions to all! ;-)

HTML <a> hyperlink target inPrivate / incognito window [duplicate]

This question already has answers here:
How can we open a link in private browsing mode
(2 answers)
Closed 8 years ago.
Is there a way, via Javascript or other code, to open a url in a private/incognito window from an HTML page? Ideally cross-browser or at the very least IE and Firefox.
The anticipated behaviour would be along the lines of
Link
The simplified reason for this is because admins want to be able to log in as users to preview various pages, but without logging themselves out. Whilst there are various other ways around this issue, this would be the simplest (assuming it is possible).
We can't force the visitor to view the page in an incognito/private window. Browsers provide no API that would make that possible outside of an extension.

Google chrome doesn't open multiple mail clients

I have the following code in which I am trying to open multiple mailclient
It works in Firefox but dont work in Chrome
<button class="button">Open Email</button>
$(document).ready(function(){
$('.button').on('click',function(){
window.location.href = "mailto:user#example.com?subject=Subject&body=message%20goes%20here";
window.location.href = "mailto:user#example.com?subject=Subject2&body=message%20goes%20here";
});
});
Here is the fiddle to it
Anyone knows whats the reason behind this , or is there any other technique to do this?
Thanks
Chrome allows only one opened window per user action. If opening new browsers window was the issue, you could tell the popup blocker to allow it, but this is not possible when launching email windows. You could either require two user actions (e.g. two buttons) or you could make a web based mail form to do the same thing (if you're using the mail client of tracing purposes, just make it send a copy to yourself.
If you want to open multiple links you shouldn't use window.location.href, it opens link in current window and you cant really have more than one link opened in one window. You should use window.open(your_url) for that, but beware, it will create popup windows.
From a browser perspective mailto is a link like any other, so assigning it to window.location.href twice in a row is like fast-clicking two links in a page, browser will process only one of them.
And the last, code from your question not working even in FF if you use browser based mail client, like gmail.
You could supply 2 links for the user tp open the email clients manually, you could also open the client, refresh the page (indicating something on the url for the second one) and then open the second one?

Getting direct URL while clicking javascript button on specific website

I am displaying an online internal website.
Upon clicking on a button "A" it processes a task, and goes to another HTML page. However, this direct address is like "hidden" (hard to explain).
For example, for each page I am accessing by simple button click, it's always the same URL (like http://host.com for every page I display from them).
I am using Firefox, and I need to know how to get the exact HTML address (or direct URL) used for displaying these full new pages. I managed to do it few months ago, but not anymore.
It will help me to automate some tasks and bashing programs. I am openned to any linux browser in case you find a way to help me. Thanks a lot.
it sounds like domain masking is used. you could check the source and see if a frame is being used on the page. the source should indicate the src of the frame, revealing the location of the page.
<frame src="page.html">
If the button uses window.open to navigate to the url, you could override that method and intercept the url there:
var oldOpen = window.open;
window.open = function(){
console.log(arguments[0]);
oldOpen.apply(window, arguments);
};

Categories