How to pass request URL to mailto body - html

I need to pass URL to the body part of the mailto link.
Sample URL :
www.test.com?param1=value1&param2={value2}
If i pass this URL, it's cut down after the '&'. So, i have tried to encode the URL like below:
www.test.com%3Fparam1%3Dvalue1%26param2%3D%7Bvalue2%7D
It works, but the URL is not readable. How can we achieve this without encoding or showing readable URL in the mail body?

Try this bit of code:
Send Mail' with current webpage (offline mode will send file location on disk).

When is doubt, read the specification:
http://shadow2531.com/opera/testcases/mailto/modern_mailto_uri_scheme.html
Validator available at the bottom of the page.

Related

See HTML response in chrome network

Hello when I send my html page with google chrome I can't see the path in the link Bar Though I use the method get and when I open the network angle I can't find the query request either enter image description here
On the first view is see that your request goes again a html page. Then you will get as response the html. But i suggest you will send some data. Then you have to add in every form element a name selector. Like <input name="username" ...>.
Then you need a endpoint which can handle your request. A HTML side cant do that. You need a serverside endpoint. Like api.php etc.

HTML web link vs typed url difference

Can someone please help me understand why a linked clicked in PC browser (in my case FF) works. But when I paste the same URL into a new tab on the same browser I get a different response from the server?
Go to this page : http://networkprogramming.wordpress.com/2013/08/06/html-to-pdf-proxy/
Click on the link text "http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4"
This runs a service at www.htmlpdf.com and converts www.google.de into a pdf and downloads it.
Now open a new tab and paste the same URL either from the page text, from the page source or the URL field and press return and the server returns: Unexpected error occurred, unable to convert this URL to PDF.
I don't get it, why does the link work from a click but not from a new tab?
The page source confirms the real URL as:
< a href="http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4">
I've tried substituting ampersands with '& a m p ;' (without spaces) but that does not work.
Any ideas?
It seems that the service accessible via http://www.htmlpdf.com/iframeconvert? is checking the REFERER of the GET request. In case it there is no REFERER set, you'll get Unexpected error occurred, unable to convert this URL to PDF as a response.
Give it a try on this page: http://www.rexswain.com/httpview.html.
Simply put http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4 as the URL and send the request once with a referer and once without.

UIActivityViewController UIActivityTypeMail ruining my mail urls

I am trying to send an email from my app. I format the email in a custom ActivityProviderMessage along the lines of this:
return [NSString stringWithFormat:#"<html><body>This is my html email body and
here is a very long url link: Long url link</body></html>", _url];
The problem with this, is when I receive the email and take a look at the source, the url is screwed up because it has been put on multiple lines with lots of = inserted at the end of each line.
The URL is actually a Base64 encoded image, which when pasted into safari shows the image fine.
Here's an example of a small image url, paste it into safari and you'll see the image:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxMTFGOTk4Q0NGNzIxMUUyOUY1REQxQkQ4NDFFMzEwMCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxMTFGOTk4RENGNzIxMUUyOUY1REQxQkQ4NDFFMzEwMCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjExMUY5OThBQ0Y3MjExRTI5RjVERDFCRDg0MUUzMTAwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjExMUY5OThCQ0Y3MjExRTI5RjVERDFCRDg0MUUzMTAwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+R9i41AAAAedJREFUeNq8l81Kw0AQx9NQPHupoAhttVqw2oqePPkK3n0DT55sK1ZBq1a9+CIefADPnvyoVfEzVVAQwZMoFEGchQ2Mf3aTTdp04E93N7P5JbszO2kssfZjRWAOKU0aJL2qHOwIocJeSCPdAN8yqGt3pGyU4AZpVHPthjQUBficNO7j80ga6CT4ilQw9BWBlhCNeJvQJ1Iy4Jx3Up/dZvRy6FuAuWdhwU2I3gqpX/762YPI7zBgMTEF0KpsV33gDTev7RCBNMz6RQa1GLyomHtByoeJ6jppjPXLpF3DudcY+abgf09LViLVNL4rpB3I3xw6maTTPSnD+kukPQ/oBqRbRuUYN4jeFLypDroM0CYek6ZL7QAUl9CCINtk/WcvqBfYgTxdhRsjtAaBlPLbP9ugtOES4p7WIPJzJtFq+5Q2sWTbmrkleKBL0qRpbiIYS1tS5itaGR5IFPuJICcRBy9ofLbgGKzIMR692aDnbhwCyLUp0gHb63XSL2sbpYyXxeRXZg+pxcc1eYy1OB22ptqKvZ1nbXHjY02FCg3lS32iKOizshLNKCI/3+73kgD3wpiIziOPYlGwOmBiqb9hbF/h90Fa7BTUfeOWx/U50mEU/3FU1WmadGpFbAL8KY9J8ftldcn+BBgAl0Jc3zM1awwAAAAASUVORK5CYII=
Now when I log the message returned from my ActivityProviderMessage method it looks like this, which works as it should (Paste into a .html and open it, the link shows the image):
<html><body>This is my html email body and here is a very long url link: <a href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxMTFGOTk4Q0NGNzIxMUUyOUY1REQxQkQ4NDFFMzEwMCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxMTFGOTk4RENGNzIxMUUyOUY1REQxQkQ4NDFFMzEwMCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjExMUY5OThBQ0Y3MjExRTI5RjVERDFCRDg0MUUzMTAwIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjExMUY5OThCQ0Y3MjExRTI5RjVERDFCRDg0MUUzMTAwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+R9i41AAAAedJREFUeNq8l81Kw0AQx9NQPHupoAhttVqw2oqePPkK3n0DT55sK1ZBq1a9+CIefADPnvyoVfEzVVAQwZMoFEGchQ2Mf3aTTdp04E93N7P5JbszO2kssfZjRWAOKU0aJL2qHOwIocJeSCPdAN8yqGt3pGyU4AZpVHPthjQUBficNO7j80ga6CT4ilQw9BWBlhCNeJvQJ1Iy4Jx3Up/dZvRy6FuAuWdhwU2I3gqpX/762YPI7zBgMTEF0KpsV33gDTev7RCBNMz6RQa1GLyomHtByoeJ6jppjPXLpF3DudcY+abgf09LViLVNL4rpB3I3xw6maTTPSnD+kukPQ/oBqRbRuUYN4jeFLypDroM0CYek6ZL7QAUl9CCINtk/WcvqBfYgTxdhRsjtAaBlPLbP9ugtOES4p7WIPJzJtFq+5Q2sWTbmrkleKBL0qRpbiIYS1tS5itaGR5IFPuJICcRBy9ofLbgGKzIMR692aDnbhwCyLUp0gHb63XSL2sbpYyXxeRXZg+pxcc1eYy1OB22ptqKvZ1nbXHjY02FCg3lS32iKOizshLNKCI/3+73kgD3wpiIziOPYlGwOmBiqb9hbF/h90Fa7BTUfeOWx/U50mEU/3FU1WmadGpFbAL8KY9J8ftldcn+BBgAl0Jc3zM1awwAAAAASUVORK5CYII='>Long url link</a></body></html>
However the received email source in mail.app looks like this:
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head><body dir=3D"auto"><div>This is my html email body and here is= a very long url link: Long url link</div><div><br><br>Sent from my iPh= one</div></body></html>=
I notice that the received email automatically has a new Head tag in it, even if I supply my own in the email:
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head>
So, to get this working, is it simply a case of finding a right format for the url?
Or perhaps I need extra fields when I generate the email to tell mail.app not to change anything?
Please help.
Thanks
If you are trying to send an email with an attachment, then use this method:
- (void)addAttachmentData:(NSData*)attachment mimeType:(NSString*)mimeType fileName:(NSString*)filename
Otherwise, if your goal is to show an embedded image inline in the message, then you should use a standard <img> tag in the body of your email with a url that points to an image already publicly available online.

HTML href Link is not clickable

I want to send the following snippet to my gmail account, however it does not resolve into a clickable link in the email I recieve.
Link
Full Code (JavaScript / Google Apps Script)
function test() {
GmailApp.sendEmail("X.X#gmail.com", "Mail Subject", "",{ htmlBody: "<a href='evernote:///view/XXXXXXX/sXX/f473d94d-ac3d-43d0-a838-0c9f55d622c6/f473d94d-ac3d-43d0-a838-0c9f55d622c6/'>Link</a>"} );
};
When I put the snippet into another editor ( e.g. http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic) , the html resolves into a clickable link as it should.
What am I missing here?
(Btw. Link works fine, so there is a problem with the evernote:/// url type)
URL should have http:// or https://
evernote:/// is not a protocol that everybody understands. Even if you put the same link in your browser it will not work. As the previous answer suggests, you must link your href tag to a http:// or https:// protocol.
Although the w3schools page creates a link out of it, nothing happens when you actually click it.
Try this
String body= HttpUtility.HtmlDecode("Link");
Pass the string body as parameter

Chrome extension, replace HTML in response code before browser displays it

i wonder if there is some way to do something like that:
If im on a specific site i want that some of javascript files to be loaded directly from my computer (f.e. file:///c:/test.js), not from the server.
For that i was thinking if there is a possibility to make an extension which could change HTML code in a response which browser gets right before displaying it. So whole process should look like that:
request is made
browser gets response from server
#response is changed# - this is the part when extension comes in
browser parse changed response and display page with that new response.
It doesnt even have to be a Chrome extension anyway. It should just do the job described above. It can block original file and serve another one (DNS/proxy?) or filter whole HTTP traffic in my computer and replace specific code to another one of matched response.
You can use the WebRequest API to achieve that. For example, you can add a onBeforeRequest listener and redirect some requests:
chrome.webRequest.onBeforeRequest.addListener(function(details)
{
var responseData = "<div>Some text</div>"
return {redirectUrl: "data:text/html," + encodeURIComponent(responseData)};
}, {urls: ["https://www.google.com/"]}, ["blocking"]);
This will display a <div> element with the text "some text" instead of the Google homepage. Note that you can only redirect to URLs that the web server itself is allowed to redirect to. This means that redirecting to file:/// URLs is not possible, and you can only redirect to files inside your extension if these are web accessible. data: and http: URLs work fine however.
In Windows you can use the Proxomitron (proxomitron.info) which is a local proxy that can intercept any page or file being loading into your browser and change it using regular expressions (no DOM parsing) however you want, before it is rendered by the browser.