File upload not working if the form link on Gmail is accessed on IE 9 - forms

My application sends email to users with a link to the application page where the user can upload a file for a business requirement. If the email is sent to a gmail id and when the user open the email in IE9 and clicks on the link, it navigates to the application page and when he tries to upload the file, it fails. There are no error messages shown on IE9 developer console.
The upload works fine in all browsers other than IE9.
If the user opens the link by right click -> Open in New tab, then the upload works fine
If the User clicks on the link directly, which by default Gmail will open in new tab on IE9, the upload fails.
I verified the URLs in either cases and there are no differences. I tried playing around with target attribute for the link (new, blank etc) and nothing helps.
Copy pasting the link in a new tabs works. But not clicking on the link

This is a IE9 issue - apparently you can work around it by setting IE9 in IE8 mode in Gmail (nice huh!)
Anyway there's a good write up here (and link to a demo project showing the issue):
https://github.com/blueimp/jQuery-File-Upload/issues/457
IE9 (and possibly other IE versions) doesn't allow submitting a HTML form programmatically (neither via form.submit() nor via button.click()), if the containing document has been opened via a Gmail link.

Related

Show pop-up when clicking on links in email contents

I am facing a new requirement. My website has email sending facility, which contains links also. What I need is to show popup when I click on the link in the email contents, the contents may or may not be from the website. Which methods I can do for achieving this?
The only way is to have a link to an external page that will open in a browser and execute the popup.
If the content is not from a website I can't see a way of doing this. It will require javascript which cannot be used in an email.

Opening a custom url link in Safari/GMail

I am sending a custom url scheme link inside an email:
[body appendString:#"<div><button type=\"button\">Open in App</button></div>"];
This successfully adds a button in the email I am sending which, when tapped, opens my app (if it is installed).
This works fine when I open the email in mail.app on the iOS device, but doesn't do anything when I open the mail in Gmail (both via Safari and the native GMail app).
Is this a limitation of the framework? Or should safari be able to recognize these links?
The best solution I've found for this is to link to a PHP script on a web server that takes parameters and redirects the request to your custom URL scheme within Safari.
This link will be in the email:
http://myserver.com/_script.php?parameter=one
This then redirects to:
myappscheme://open/?parameter=one
It does mean you have to open Safari to process the link, but given that you're opening the link from the GMail app anyway, I think thats a minor issue to get this working correctly.

How to send a Facebook page as url using the Facebook send button?

I will try to explain a bit the context for my problem.
Context:
A while ago I started working on Facebook application. One of the requirements is to be included in a Facebook page as a tab. This application will contain on a page a send button in order to be able to make it more engaging with specific people, users of the application would choose on their own. The reason behind this is because the Facebook page containing the application is related to alcohol, and "liking" the application will get more audition and potential children. Another reason for using send button rather then other similar options from Facebook (like send dialog etc.) is because in Facebook documentation was stated that send button works on mobile devices and other options don't.
Problem:
My problem is related to the send button. What I need is to be able to completely configure the send button: url, image, title, description. I have research the open graph tags in order to be able to do this. Everything works fine if the page I want to be sent with the message is a website OUTSIDE Facebook. Once I started to use the url of a Facebook page (let's call it www.facebook.com/mycustompage), then the crawler takes the images, title, description from facebook.com ignoring the actual page and the produced message is not what I want.
I have searched a lot to better understand this limitation and could not find anything relevant.
The only article I could find as a potential solution was (and even this I had trouble finding):
Send button returning error codes, like button works fine
The above discussion is a workaround which I have already put in place but is not 100% what I want. The described workaround is about putting in the send button:
<div class="fb-send" data-href="http://www.mycustomdomain.com/og"></div>
a page that sniffs the user agent. In case the user agent is Facebook crawler to serve an html empty page just with the open graph tags, otherwise redirect to the desired URL - which in our case is the facebook page www.facebook.com/mycustompage.
The message produced contains:
the title which is a link to www.mycustomdomain.com/og which when
clicked opens a page in a new tab with the address
www.facebook.com/mycustompage - this is relatively ok
under the title I have a "sub-title" readonly text containing the domain of the link: www.mycustomdomain.com - THIS IS NOT OK since I don't want to share where I have hosted the application.
the image and the desired description - this is ok.
Conclusion:
What I want to know if there is a better way to do this rather than this workaround.
If not I would like to know how I can hide for the produced message the "sub-title" so that the hosted domain is not visible.

Open iPhone App from an Email Link

I've working on a program where an email is sent to a user, and a link to open the iPhone app is embedded in the email. The problem is that when the user clicks the link to open the app, mail has stripped out the colon, so the link no longer works!
The link being created basically looks like this:
#"<BR><BR><BR>Open App"
But the link, when clicked in the email, opens this in the browser instead:
myApp//
with no colon, so the app doesn't launch and the browser says it can't find the page.
Any ideas how to fix this? Thanks!
It just should be:
#"<BR><BR><BR>Open App"
As a workaround for custom urls being blocked by gmail, what you could do is set up something like http://myapp.mydomain.com/ up do redirect to myapp://... That way it'll look like a normal domain but open your app. On the plus you will be able to see how many people click your link, though on the down side it'll pop via Safari first.
Add 'http:' to all your images and urls, iphones dont recognize links w/o that. also use single quotes for them(').eg.
<a href='http://xyz.com'></a><img src='http://xyz.com/pqr/abc.jpg'></img>

Error when using mailto: link in Mobile Safari in app-capable mode

I've got a form in a web page with an action that is "mailto:email" (where email is a real email address). When I load this page in Mobile Safari in regular mode (ie, not launched from home screen with app-capable mode), this works fine - after I submit the form, the email app comes up. However, when I'm in app-capable mode and have launched from the home screen (so, no Safari chrome), and submit the form I get the error "URL can't be shown". However, a regular mailto: link (ie, not in a form) does work when in app-capable mode.
Has anyone else noticed this? Any workarounds? Are forms disallowed in app-capable mode?
Thanks,
Elisabeth
This accurately describes the issue. There is nothing wrong with the mailto link, the mailto link fails to load. Often the webapp crashes.
The funny thing is that tel: link for telephone numbers work fine.
window.location.replace does in-fact work. Thanks!
Here is the jQuery to fix this automatically...
$('a[href^=mailto]').click(function (event) {
event.preventDefault();
window.location.replace = $(this).attr('href');
return false;
});
I think I've figured this out. I noticed when in app-capable mode, any http link will take you out of the app and launch a separate mobile safari window, take you to the page and show the Safari chrome. Makes sense (typically one wouldn't link to anything from an "all in one" app-capable web app. I noticed this because I implemented a 4 page app with my own "tab bar" at the bottom and was linking amongst the .html files with plain http links in the a element. When I replace this with a javascript function to load the pages using document.location.replace this doesn't happen.
So, on the form - I think what must be happening is that because I'm using a scheme (in this case, mailto:) somehow the browser is needed in "regular mode" to interpret the scheme and do the right thing by launching the email app and this clearly doesn't work when submitting a form. I haven't yet found anything in the Apple documentation specifically about this, so if anyone knows the technical details, please do post!
UPDATE: I did find that I can access a server side script using a form in web-app mode, so I'm still curious about the mailto: issue, if anyone has an answer.
Thanks,
Elisabeth
I am having the exact same issue with mailto links not working in the web capable mode. I just got done submitting a bug report to Apple. Let's see what happens, meanwhile I found another dev. platform for web apps that works in web capable mode and mailto links work, but it is funny how it works in this even--it is not as fluid as it is in Safari. Because even in this new web dev tool that I found, it closes your app and launches mail client, which is lame. In Safari it just slides in a mail window that slides back out if you hit cancel or send--it doesn't actually close your app.
Here is a workaround that does not depend on JQuery:
aTmp = document.createElement("a");
aTmp.href="mailto:example#example.com?subject=Test&body=Hello.";
aTmp.click();
Update: To run this code from a bookmarklet you have to wait about 1000 ms before the bookmarks bezel is closed and the browser is ready to respond. I realized this by wrapping the code in a setTimeout function.