iOS 7 vCard header issue with InAppBrowser - header

With iOS 7 it´s now possible to export vCards the normal way.
(Take a look here: https://stackoverflow.com/a/11405271/2861693)
My header hence looks like this
case "ios_seven":
header("Content-Type: text/x-vcard; charset=utf-8");
header("Content-Disposition: attachment; filename=\".".utf8_decode($this->contact->getLastName())."..vcf\";");
echo $vcard;
break;
and works really great when opening the webapp with safari. But as soon as I call it with an inappbrowser (which is a common case because the link is retrieved by scanning a qr-code), it fails loading...
Somebody got an idea for an inappbrowser-compatible header for exporting vCards?
Best Regards, Erdan.

If you change the "Content-Type" header to "text/vcard", it may work.

Related

GET request to download PDF using apisauce in react native

I am using apisauce for basic HTTP requests like GET and POST, and it works well. Now I need to be able to download pdf files too. Is this possible with apisauce? If so does anyone have some sample code?
Because when I tried to hit the API in postman, I got a response like this below. after I save the response as a file, and the pdf looks good. but when I hit the API using apisauce in react native, I got null in data. even I added responsetype: 'blob' when creating the API, but it doesn't work. do i need to add anything when create the API.
��WkL��wfv�\`Yc؅]��������cwyc�`��/����G�*7�U;)q+��4��4�\+�I�ZV�����?v��m*9�e{��{g�-��g4s�=�s���9wgFE��"h2Yw��p~O�����wd]��6u�w��O�����9�����0_��npdznf5:��0��֜��o�bb����q�A>�W�\3�=����}E��0�!�i�VԊ#�DVlnt�r,�p]������Jw,kVW���b���_"2�-��
"�!���R�zR %JEȦ�*�Z�ώ�H��\Z�
'��cOs�C%8h�j��Z.\,m~}�<��2��ߞ]�xq�9~~~�|��~<����W6إT�BiZ�V�U���c\��S�X�|kU�cX-z�Wp!��M§�M�
s�"S��D
�����"�5�H(a�e.A�qW�,���W�sga�!���I�rU�+��t�!g��<�4�&�m�����g>�>y��!�~?�~����C6�'������+܃��b���q9mVU�29B�m~�c��_��j�3��r:]
A�4��׸BYU�����])�'9�xKC��L�hW�ly�\�r�ٍ܌c�ɥ�7��ۚ;M��ƪ�t��7mf��OQ�쬲��֡����n�;�7�p|���9��7�WWge��w�Vc���<�qv��UJbBBBbM�V[PPRR���9����Ɩ�l��8SS�IV%$��'y����4��eeA|���i��""Cn� U�$Kt\�,���v#J �o���k�i��l�s��dž���(*i �����G������UOL�
�Z��꓋�v��۝fffd����O&'1�ޔ|�f�D��-C���PI(��M�&�kq�Ba�����^�_��|�Se��e�#�,���^}a_)����}/�\8Ii����wvC_�/�L�S���;��*�m��`�d# %E��l�9�m޵�)6��pz)2*.�|H�l���>|��$�{baV�G��g�b62�"jպ�{r+�p�e����v
��$�0���ҝ��1qJU�6�Z���&&�������Y�;�'���8�����e�]��B����Fƥ���Q1�1[RRY-.����Z�J��o�x=���_V�i�e����p�~���J�1 2ם�)G�D���ZP<
n�]�.�����l7�L�ֹ�gw�T{��t��VOuK�����ƃO��WO,46�n`U���԰���lV*��=u���ԭJ�\Z�hn�Xl����Ʌ�={*_�y+�m�/T��l{����z�����|`���X�:��܇�A��5�f�%r-�����.f]�Z%,$ǘsG�&������#O��5
�1�/4��=u�!h8z4������ӯ,jo5�����qzq���l���K&�1��piv����B�gs`r�c����b���0��K�;wH��Q�K���0%'����Í��pf��::<��<��r=������v���<����]D�yW'�f�dT�t�����C����,8������z�ݕ:�
��e?\ˇ��Ļ x� {NӃ��P��<9u]�9�������(J��eo-��kh)r9cq�w�Hg���x�!?/��r��j��S������Oe�.}��E�q��ϡ��T&��)}\��s�g�j�U��u�]�L���$�zB���%��a���)Q�˞�"�W��#���e7���k��G��������%Zst�S�w`��T����\�:ɨ0�X���hk�nl�����b��k蓼3����V���_-Lr��-�%������$�N�/I����4k���ؤDE�!W/�cӱ��DedB�"������v��-La9}M�qz�V'�����[������;B���dV���Հ�Z���D8�
�ԡ���Qe�૵��̲����Z�n4��:�G
�fc�Q�'�{���T슉_ۀ�/�V�?V��+�j^�����wm/l����do-���UV���Җ=���(E�Z`��vfs6������7�,[R�4%��r�[g��l�p7B��Bg�5�9��8��=��H�Z��
���i��{b���"c�b�&07���������)7�S�1��Q�b�:�[���WSﯭ��"]_��W�F��U>oC��W%쥟���Y6�����~�&�]���X�|�
�BHqrնj�w��JW�l�榐MևV���OB�4����8�ͨ���V���]E+� �z�'���̓��p�GA΅Z�|��E����2k��AЄ/W�D3p����|<���W���e�0��4��b�ȥq�pK���uY�{�_7��\��e�U����xD�I�D3� �,*�r��|�H�M�A��#��DG�����Hdgޗ�(��ܐ�hdec$:�հ;$:�坨��q4�&�#�h�/X�01��5ں��U��#����S�׏F`$�rFQ/H'�.ywSYHr��i���9lB��m�akF�92�qx5
Z��)x&Ѭd�
V�R�`a���Io� ��`�_�{���n�!^�7����5+�4�ۂ�Bl���Q7�)��i�w���u���)��x��g� �9��
�Ad�t�,�,Tf�oA'HG`���Y���`���;�qB-�a��!���w�3M3�G��
�c���6�C4j�K����5YP�Jq�Q������8H��P�34�Z�j�Cyj��#����JVxuN�N��i��jl�8M�.�mU�%��(�c��T�-�Lx]c����r�=H�_U�N,4�u���w=dz���b���n����JO"��Й�$��#y������#��>O�7F}t����+D��T��r�/>�N:����Di�2�k��r8;�퇹N�&�n#�+`�C
���Т��V�턱$d
��/�#f��A�������4������7��P�Fc�T���U{�J
��( >�T
I have searched in google but I don't have any clue and i am new to react native.
Can anyone please let me know how to solve this issue.

TYPO3 8.7.2-8.7.3 & fluidpages blank page

After updating from TYPO3 8.7.1 to 8.7.2(8.7.3) in frontend just blank page - nothing rendered. All empty <head>, <body>, etc. Also updated to last FLUX, FLUID, fluidpages, fluidcontent, vhs. No result. After downgrade to 8.7.1 all works.
Tried also clear instance - againe no results. Looks like 'fluidpagesRawTemplate' wich shood render all frontend not call at all.
Somebody face with this problem?
PS:
- My EXT use 'fluidpages'+'flux' for backend and frontend layouts.
- Have no erros or warnings in TYPO3 logs or php server logs.
Sounds like you are affected by a regression that was introduced in TYPO3 8.7.2. Look for config.metaCharset = UTF-8 in you configuration and remove it or change it to config.metaCharset = utf-8.
This bug should not be present in 8.7.3 anymore. Please update your TYPO3 to 8.7.3

iOS access to Safari Reader feature through UIWebView

I am using iOS 4.3 & was wondering if there is any way that I can access the Safari's "Reader" feature through which webpages are removed of ads & other riff raff & the content takes the center stage.
If one opens any article in Safari (on say Wikipedia website), then a "Reader" button appears on the URL bar. Clicking on it presents a new window presenting the content beautifully.
How can I leverage this this functionality in iOS through UIWebView ?
PS: I know there is something called Readability Project. But I have no idea how to use this through UIWebView. Also for some websites Safari's Reader takes a call not to enable "Reader" feature, maybe it has no sufficient confidence?
Important: THIS ANSWER NO LONGER WORKS!
Readability shut down on September 30, 2016.
Here is something they recommend as a replacement:
https://mercury.postlight.com/web-parser/
Keeping the answer as a historical reference
--- Original answer ---
You can use Readability mobilizer for this. You will get a cleaned up version of any article, in the Readability styling:
http://www.readability.com/m?url=http://{URLOFTHEARTICLE}
Just prepare the URL and load it in your UIWebView. Here is how it looks in action:
http://www.readability.com/m?url=http%3A%2F%2Fwww.cnn.com%2F2013%2F01%2F11%2Fshowbiz%2Ftv%2Fgolden-globes-tv-vineyard%2Findex.html%3Fhpt%3Dhp_abar
Apple is making a pretty big deal about the inclusion of "Reader" in iOS 5. I'm assuming by the noise it's not available in 4.3
re: How to use through UIWebView
I can't find any mention of it in the Web Content Guide.
There's nothing about it in the UIWebView class reference.
And there's nothing in QA1630.
Dont parse HTML natively on iOS, I have done it before and its a messy business. Either create your own web service to do all the nasty work or look into using readability (readability.com) they provide an API.
There is also an open source ruby, python and php readability port that you can find here
https://github.com/iterationlabs/ruby-readability
https://github.com/gfxmonk/python-readability
http://code.fivefilters.org/p/php-readability/source/tree/master/
For you ruby enthusiasts, readability is also available as a gem, just google it.
Actually reader button do a bit of analysis where it parse the HTML Page and then it sees a clear body tag to parse. If that plugin is able to extract the exact body it will enable the reader button (My understanding from the readability source code). Now to implement the same for webview you just need to embed java script in your code (this java script is already available in the readability source code) and then you can achieve the same effect.
But I suspect the future plan from apple for the same. Because they can not just let anyone else do this content extraction with the huge business opportunity associated with iCloud with the combination of readability.
If you want you can simple extract the HTML from UIWebView and then extract the body and use it for your purpose. It's not a very rocket science to extract.
For analysis point of view, just have randomly some 10 HTML pages with Reader button enabled, you will see the core cotent belongs to body only and rest of the add, header, footer are separated.
I believe this is the time to re-invent the web content we use, and this is the perfect example of doing the same.
You can even do this by injecting javascript.
#define readJS #"(function(){window.baseUrl='https://www.readability.com';window.readabilityToken='';var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('charset','UTF-8');s.setAttribute('src',baseUrl+'/bookmarklet/read.js');document.documentElement.appendChild(s);})()"
And then when your webpage finishes loading
- (void)webViewDidFinishLoad:(UIWebView *)webview
{
[webview stringByEvaluatingJavaScriptFromString:readJS];
You can do it in iOS9.
first import SafariServices:
#import <SafariServices/SafariServices.h>
Afterwards we are instantiating SFSafariViewController and adding it as a subview. We have two options doing so:
Creating with only base URL
Creating with bas URL as well as entering 'Reading Mode' in case it is available
NSString *sURL = #"http://google.com";
NSURL *URL = [NSURL URLWithString:sURL];
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:URL]; // 1.
SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:URL entersReaderIfAvailable:YES]; // 2.
[self presentViewController:safari animated:YES completion:nil];

view .doc, .docx, .rtf, .ppt file in iphone using Webview

I want to view .doc, .docx, .rtf, .ppt file in iphone.
But I guess something is going wrong at my side and its not working for the above formats but my code is working fine for .txt and .pdf files.
I have the read the document regarding Webview it states it supports viewing of the above document.
below is my snippet for .doc
[webView loadData:requestData MIMEType:#"application/msword" textEncodingName:#"UTF-8" baseURL:nil];
for .ppt I am using MIME type as "application/vnd.ms-powerpoint"
Note: If I am making MIME type as "text/html" for .doc/.rtf then it displays some garbage data So I think there is something missing in MIME type from my side.
Any help is highly appreciated.
Waiting for your reply.
Update:........
It seems there is some issue with NSData for opening these type of file formats.
My data is encrypted so I cannot use
requestWithURL directly and other thing is I need to pass credentials to get the file and the credentials doesnt work proplerly if I save the credentials using
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential
forProtectionSpace:protectionSpace];
and then make the request using below
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]] ]
Is there any way I can use NSData for the above formats so that I can make async call and pass my credentials and then decrypt the data and show it in WebView.
Try using a QuickLook Framework which is an amazing feature given by Apple. If you have seen this that when you select ANY FILE on MAC System and click SPACE BAR then you will a quick preview of your file it may be any thing... *.pdf, *.doc, *.docx or any thing... Even if you have not installed those softwares for same files you will get a PREVIEW for those files...
QuickLook framework also gives same functionality... Please go through some of the links for the same..
http://robsprogramknowledge.blogspot.com/2011/02/quick-look-for-ios_21.html
https://github.com/rob-brown/Demos
https://github.com/rob-brown/RBFilePreviewer
http://robsprogramknowledge.blogspot.com/2011/02/quick-look-for-ios_21.html
(Recommended..) http://iosdevelopertips.com/data-file-management/preview-documents-with-qlpreviewcontroller.html
Not all of those formats (docx) are supported. This looks like the official word. In the example Apple does not specify a mime type.
This question suggests that you must use an NSURLRequest instead of loadData.
Edit:
As far as I have seen, you cannot directly pass data to loadData for these types.
The easy work around is to write to a temporary file. You can delete it in webViewDidFinishLoad or, technically, as soon as the the file has been opened.
The hard work around is to use NSURLCache. You should be able to implement a custom NSURLCache and have WebKit use it via setSharedURLCache. Your cache would basically know how to get your local encrypted files and pretend that they are cached. I have not tried this, but I think it is your best bet. This approach may be blocked just like loadData is.
You need to supply something to baseURL:. For example:
[webView loadData:requestData MIMEType:#"application/msword" textEncodingName:#"UTF-8" baseURL:[NSURL URLWithString:#"http://localhost/"]];
Works for me now.
Try it on an iPhone instead of Simulator

Secured and unsecured items message in IE

I'm getting "This page contains bothe Secure and Non secure items"message in IE. When I commented the following piece of code from dojo.js.uncompressed.js file, the message is gone.
if(dojo.isIE){
if(!dojo.config.afterOnLoad){
document.write('<scr'+'ipt defer src="//:" '
+ 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">'
+ '</scr'+'ipt>'
);
}
Is that an issue with the dojo? I would like to move the commented code to another custom file so that the dojo framework is not affected. Can you suggest a better way of implementing it.
Thanks.
You would get that error if you're using frames or have external files where some of the files have https URLs while some have http URLs. Assuming, your main page loads up through https, you could try changing:
src="//:"
to:
src="https//:"
the //: is most likely the problem, as I ran into a similar issue with a chunk of javascript code... In internet explorer, the locaiton //: is not secure, so when your page (presumably on an https:// url) loads, IE notes that you've got your main code loading from a secure location, and another script being loaded in from an unsecure location.
The workaround that I came to was to create an empty file in my web root named "blank.html" (though "blank.js" would probably work better in your case) and replace the //: link with "/blank.html". This results in another hit to your webserver, but browser caching will probably make that impact minimal.