Is there a limit on the size of the variables in a custom URL handler? - iphone

I need a way to transfer a bunch of information (1-10kb) from an email in the Mail application to my iPhone app.
I was thinking I could craft a custom URL in the body of the email that, when clicked, would transfer the information through a custom URL handler to my app.
However, it's a lot of data. Can I pass that much data in the custom URL handler? e.g. myapp://load?var1=[lotsofdata]&var2=[lotsofdata]
Or, is there some better way I can transfer info from the Mail app to my app?

I don't know what the maximum length is, but I do know that you can have very long data-urls in Safari, which let you store image or other file data in the url itself. If the limits are similar, then you are in luck.

The usual limit for a GET should not be longer than 2083 characters to be on the safe side.
But also it should be a method to read the email directly from your own app, but I'm not very familiar with this solution.

Instead of a link in the email, you could probably just create a form that posts the information instead of sending a get request to your site; that would get around your length limitation (if there is one)

That last answer assumes you have a site to put the data on. If you're trying to keep things purely in email it would be nice to stick the data in the mail message. You can embed images in an email anyway, so why not?

Doing some research, I came across two blog posts that claim to have created large URLs that have worked, although one is using the data: URL scheme and the other is using mailto: .
Your best bet is to probably just try it out: Create a link using myapp:// with a large amount of data, stick it in an email and see if your app reads the entire thing.

Related

Is there a way to embed an iframe in an email with text that updates?

I want to embed an iframe inside an email that contains the 10 most recent chat messages. Is there a way to make this iframe dynamic so that it always shows the latest 10 chats regardless of when the email is opened? If the iframe is not the correct way to do this, is there a better way?
You can implement an iframe into the email - but your mail will be recognized as spam by many providers.
You should try to render your content dynamically into an image and implement that image into the email.
There kind of is a solution. It is using Dynamic CSS with a fallback of a Dynamic image to pull the information. It is not elegant really as for some clients (e.g. Outlook) this is not available at all and will only display initial information. It also utilizes a link for a style sheet which also severely limits which clients this will work in.
The fall back dynamic image is a bit more comprehensive in client support, but much harder to maintain as you will need to build something that programatically pulls the tweets (HTML webpage potentially) and then also have something that creates and hosts an image for the email to pull. This is not a short, simple thing to set up and may not be worth the required back end work for a simple email.
See this link for a bit more in-depth info on how this can be done for adding a live twitter feed into an email: https://litmus.com/blog/how-to-code-a-live-dynamic-twitter-feed-in-html-email
Since there was no accepted answer i thought i would give my input as well.
Litmus had done something similar for their live twitter feed in emails sometime ago.
The method i can think off is to create a PHP page which takes 10 images and makes it into 1. PHP can have a loop that checks for increments from a specific number and if it exists then add to that 1 image. When there is a new chat image added, PHP will disregard the last one and add the new in the loop.
For anyone reading this in 2022, this is possible with AMP.
Instead of an iframe, you can create a dynamic email easily.
check out amp.dev
Note: AMP is not supported by many email clients

Facebook photo get parameters and photo available for how long

When I request a photo from Facebook, some urls are like this:
https://{hidden_for_privacy}79141548_n.jpg
And others are like this:
https://{hidden_for_privacy}23364315_n.jpg?oh=c566c56ca9fd7eb1ed5d8bfca4255e84&oe=544AF123&__gda__=1414682395_6d2cb778f5b2c857d1be1c781e81cdfa
The second one has a few extra GET parameters (oh, oe and __gda_ _ (space is there to prevent bold).
When these parameters exist, the image will be invalid after a few days because those values will be different (you can check this by doing a new API call to get the same photo).
What do these parameters mean and how are they linked to the maximum timeframe?
Thanks!
I know some history and its purpose.
Originally facebook image url look like this
https://{*snipped*}/XXXXXXXXXXX_b.jpg
but there are more than on size of image available so people have access to thumbnail image can simply replace suffix _b with _n
(So now it is https://{*snipped*}/XXXXXXXXXXX_n.jpg)
to access to larger version of the image (if available).
Some time later facebook implements central image system that can dynamically crop and resize image on the fly upon request.
The url provided by facebook at this point of time may look like this:
https://{*snipped*}.fbcdn.net/hprofile-xxx1/v/t1.0-1/p32x32/12345678_123412341234123_4123412341234123412_n.jpg
And when people see the url their curiosity arise.
Let's try remove some parameter from the url.
https://{*snipped*}.fbcdn.net/hprofile-xxx1/v/12345678_123412341234123_4123412341234123412_n.jpg
And what they get is the largest and most complete version of the image they can possibly get from facebook server.
This method was working for a long time.
When people see image in their email (mostly profile picture) they can get complete version of image without even log into facebook.
It was working everywhere include private profile picture.
The quick fix and cheapest solution for facebook is to sign request path with some signature algorithm.
I guess they use HMAC as the core algorithm and derive HMAC input from various source including request path.
This will ensure that the only party who can generate valid url is the one who have HMAC key. (presumably just facebook)
Now old issue is fixed you can not use it anymore but there are more than one issue that can be fixed by adding MAC.
It is invalidation of access to images.
Let say people once publish their photo (now other can have both valid request path plus signed signature from facebook) and later on they change their mind and make the photo private.
However, people with valid url and signature can still fetch the image from facebook server.
To solve this issue with super cheap resource considered that they already implements HMAC calculation.
(And to obscure the fact that facebook does not actually delete your image from their system when you delete it.)
They decided to mix value derived from timestamp into input of HMAC.
(See RFC-6238 for similar usage)
So signature refreshing from facebook is periodically required to gain access to photo.
This solved the latter issue with very cheap additional resource.
And here you have it.
Some of history and rationale behind facebook's parameters.
I'm certain that there is no official document about the time frame but it should not be difficult to do some experiment yourself considered that now you know that the value of time frame you want is fixed and predictable.
I think they are facebook image session keys and they produced by facebook on every image showing. So fb servers consider that the request for an image is allowed and known by facebook itself.
Sorry for my bad English and my shallow comment, but i think the solution of this problem may be that fetch a url for a new image session when old one expired. Or i don't know your whole system but maybe you can connect to that assign-keys-for-images mechanism of facebook directly and get all fresh links.
If I am right about those parameters' working mechanisms purposes, i think there is no second solution.
Sorry for my bad English again.
I found the answer (finally). The point is that the photos are not public. If you request a private photo through the API they add a query string so that the url is not valid anymore after some time. Therefore the photo is still somewhat "private". The feature is understandable and there is no workaround other than downloading the image to some other place.

Send link (or other) such that form is already filled out

Is there a way to send some a url (or other thing) to a site such that data in a form is already filled out? This is not to my own site that I control.
For example, I want to send a link to some airline flights and want to have the destination and date be automatically filled out when the link is opened.
I'm guessing not, but have gotten lucky here before :) Maybe with some kind of program or add-on or??
If its written with GET method so just try to play with the site and just put the url with all the args you found.
If it is POST, so you need to create an add-on or pretend to a browser, search the net for this kind of solution.
No, that's not possible, if the remote site is not ready for that.

Send the user to a page along with a error message

I want to set up a login page in which from anywhere on the site I can send a user to it and it will display a custom message along with it. I could use a redirect and a msg query param but is this the best way to do it?
I'm working with node.js but I'm interested in a universal solution.
If you are going for easy, you can just have GET data in the URL. But, that doesn't look that nice, if you want a rather long message, plus, GET has size restrictions, where POST (virtually) hasn't.
For using post data you could use the solution of this: JavaScript post request like a form submit question, but that gives a rather messy source code (if you want a somewhat longer text).
You could keep them in a database, and only send the ID of the message to a PHP page, and get it from the database (that's what I would do, but that doesn't mean it's a good idea, just amateur here!)
You can use jQuery or simply plain javascript to extract your message from the url; the relevant question that listed links to detailed code: jquery get querystring from URL.
Then depending on how you want it displayed, apply the extracted string to your situation.

Newsletter link tracking

I was working on a newsletter system, it's done now and it works fine. Today I was talking with a client about an upgrade for the system that does the following ->
"Automatic link tracking: View who
opened your email and what links they
clicked on."
Now, I have an idea on how to do this to add #id variable from the user query string on each link and then add a counter on each site to see who opened the link. BUT, is it possible to do this somehow else (without the counter on each link)? And how is it possible to track who opened your mail??? I saw a couple of newsletter system websites that say they can allegedly do this...
Thank you for your time!
The only way to track who opens your emails that I can think of is to use the query string trick with the images embedded in your email. This approach is obviously fragile since viewing of inline images can be turned of in most email clients.
As was mentioned; it is not possible to track everyone who opened the email. But you can track who clicked on a specific link. The method you mentioned with the #id variable will work - but instead of embedding the actual ID in the link, I would recommend encrypting that data and not sending the actual user id in the email.
To get the users who actually opened the newsletter, you can insert a 1x1 pixel image into the email as hidden content. That pixel would come from www.myserver.com/tracker.gif?foo=bar.
Then you would look at your web server log or log this request in a database so that you can track the ones who really opened the newsletter.