How do you open a link in Safari from the Gmail app?

依然范特西╮ 提交于 2020-01-04 02:32:05

问题


I am sending out an email using the MFMailComposeViewController.

MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"subject"];
[controller 
    setMessageBody:@"<a href=\"http://website.com\" target=\"_blank\">Link</a>."
    isHTML:YES
];
[self presentViewController:controller animated:YES completion:nil];

When the recipient opens this email in the default Mail app and taps the hyperlink, the page opens in Safari. This is the desired behavior. However, if the recipient opens this email in the Gmail app, Gmail presents the page within itself using a UIWebView. This is problematic for me, because somehow Gmail's UIWebView setup has prevented my page's javascript from running (the javascript runs fine when testing with my own UIWebView, however). How would I force Gmail to open my page in Safari instead so my page runs properly?


回答1:


You can't. Instead you should concentrate on making your web page capable of determining what features are available in the browser being used to view it and implement graceful degradation so users get the best possible experience however they choose to view the page.



来源:https://stackoverflow.com/questions/18282547/how-do-you-open-a-link-in-safari-from-the-gmail-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!