Invoking your application from browser in Windows Phone 8 - windows-phone-8

I would like my application to be associated with certain extension (in my case *.ecw).
The use case is that, when somebody clicks on a link in a browser (f.e. Internet Explorer) that directs to a *.ecw file (http://address.com/files/itscool.ewc), my application is launched and the whole information (nagivation context, file token etc.) is passed along.
*.ecw is a ASCII text file, so it can be viewed in the browser easily but I'd like to invoke my app when such URI/file is entered/launched. I need to process the data stored in the file and produce some output for the user.
So far I have "registered" (according to MSDN tutorial) the file association in the manifest:
<Extensions>
<FileTypeAssociation Name="ECWReader" TaskID="_default" NavUriFragment="fileToken=%s">
<SupportedFileTypes>
<FileType ContentType="application/ecw">.ecw</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extensions>
But this didn't help at all - browser keeps opening those files.
Thanks in advance.

What you did is correct. However, the reason why it doesn't work is that, while the extention of the file is .ewc, the content type that the server responds with when requesting that url is text/html and not application/ecw.
If the server responds with a ContentType text/html, it simply means that the response is intended to be read by a web browser, and not some other app.
Here's a link to a ecw file that comes with a ContentType of text/plain. Change your ContentType filter to match it and try that link in your phone, it should normally work and your app will be invoked.

Related

get a json file that a webpage is made of

I'm not familiar with web development but I believe this web page text content
https://almath123.github.io/semstyle_examples/
is made of two JSON files mentioned in it (semstyle_results.json and semstyle_results.json) and the JSON files are completely present in ram (If this is the correct term for referring to it) because when I disconnect the internet I can still browse the page and see the text content.
I want to download semstyle_results.json file. Is that possible? how can I do that?
Technically if you visit a website you're "downloading" the content. Your browser sends a request for information and a server responds by sending you the information. You're viewing that information locally. Dynamic sites poll or make further requests as you browse to keep the data updated and relevant, but it's sent to you.
If you want to easily download any of the content from the website, a simple way is to open up the development tools (CTRL + SHFT + I on windows for Firefox and Chrome), go to a source file and click save as. The network tab shows you requests that were made which includes not just files such as json but also the details of the request.
Here is a screenshot locating one of the json files in a Chrome-based browser (Brave)
The webpages may not always show that they will support json or xml return of data. For example if you inspect this webpage SEC EDGAR database using the method described above, it shows no json link but if you append index.json at the end of the link it will return the same data in json format or xml format, if you so please.
i.e: same website but with json endpoint
So it is always a good idea to see if the website hosts developer information. For example SEC EDGAR provides developer tools that mentions that the directory structure can be accessed via HTML, XML or JSON.
SEC developer information

HTML Input autocomplete not working in WKWebview

Inputs with autocomplete enabled are working properly when opening in mobile Safari but not when loaded in a WKWebview (iOS 11.3). Is this a known limitation?
https://developer.apple.com/documentation/security/password_autofill/enabling_password_autofill_on_an_html_input_element?language=objc
Try using the below format to get html autofilling your fields
<input id="user-text-field" type="email" autocomplete="username"/>
I know I'm late to the party, but I had a surprisingly hard time finding a solution to such an old problem, so I wanted to share since this is still high on the Google results.
The autofill that I wanted was for the WKWebView to autocomplete a saved username and password for easy login. However, this could present a security risk to the user, so you have to add the "Associated Domains" entitlement to the iOS app that tells it which domains/subdomains it can trust, and you have to add a JSON file to the web site server's wwwroot/.well-known directory to prove that you control the site you are displaying in the WKWebView. Once that is done, then the username/password is autosuggested the same way that it is in Safari.
Here is the Apple documentation: https://developer.apple.com/documentation/xcode/supporting-associated-domains
To summarize the steps I took, in XCode, I went to the "Signing and Capabilities" tab in my app target, clicked the "+ Capability" button, added Associated Domains, and put entries in the newly created list for all of my subdomains:
webcredentials:example.com
webcredentials:www.example.com
webcredentials:othersubdomain.example.com
And then on my web server, I added a file to the .well-known directory called "apple-app-site-association" (no extension) with the following contents:
{
"webcredentials": {
"apps": [ "ABCDE12345.com.example.myapp" ]
}
}
(where the format for the identifier is <Application Identifier Prefix>.<Bundle Identifier>). Then I browsed to https://www.example.com/.well-known/apple-app-site-association to make sure that the json was displayed in the browser.
Note: I use ASP.Net Core MVC, and the file WASN'T displayed in the browser since it doesn't use a recognized file extension. I found several methods for getting around that - I chose to add a file extension to the file and then use a rewrite rule in startup.cs so that Apple can find the file without supplying the extension in the request. You can find more on that at asp.net core - How to serve static file with no extension

Why is my iFrame HTML file not being shown inline? Instead, the HTML file is being downloaded

Up until a few weeks ago, any HTML files I linked to an iFrame would be shown within the frame. All of a sudden, Chrome and Firefox will now ask me whether I want to download the HTML file in the iFrame. It's an Apache server and I do believe it was upgraded recently. How it was upgraded, I am not sure. I was wondering if it had anything to do with the way certain MIME types get processed within an iFrame.
Note: Chrome and Firefox are the only browsers that I've tested this with. I don't think this is a browser issue though.
It's very likely the mime-type configuration is no longer properly set up on your Apache server. Most of the time, the server configuration sets the mime type of the returned object based on the file extension you're requesting. If your file extensions have changed, or if you're using dynamic URLs that don't end in ".docx"), e.g. that get processed by an intervening app server to return the file without themselves setting the MIME type, then the browser has no way of knowing what the contents are, and correctly concludes that the best thing to do is to just gives you the contents in a file.
So... set the extension of the file you're downloading to .docx or .doc. If you're using a default Apache config, that might do it. If that doesn't work, change the mime type of the returned object based on a URL filter configuration in your apache.conf or other apache config file. Or if using dynamic URLs, explicitly set the mime type in your code to one of the following:
.doc - application/msword
.dot - application/msword
.docx - application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx - application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docm - application/vnd.ms-word.document.macroEnabled.12
.dotm - application/vnd.ms-word.template.macroEnabled.12

Downloading files

Right now I have FILE to allow users to download a file. I don't like that because it forces them to leave the current page and have to reload it (which takes a few seconds) when they want to go back
What is the easiest way to have users download a file?
Have the server send a Content-Disposition: attachment header for the resource in question. It'll then be presented to the user (if they have a sane browser) as a file to "save", rather than as a new page.
For certain types of resources this may mean you write a proxy script in PHP, or perhaps you can configure your webserver to do it.
Use this method:
FILE
The most reliable way to force a download without a server-side solution is to ZIP the file and then link to this archive. Provided that there aren't any limitations on using ZIP files almost every web browser I've encountered will download the file to the user's computer.
If you don't have server-side support, which I am just assuming because you're asking about the HTML and not a scripting language, you cannot always make a file download form the browser. This is because not every web browser is configured the same and the default application on the user's computer may also be set to something you can't predict.
Also, you should use the linking method that #craig1231 suggested so that the file download request is happening in a new window.
FILE
This will cut down on some of the time needed to refresh pages and, in most cases, when the web browser encounters a ZIP file as the URL of the window it will close the window once the file starts to download.

How to get Content-Type when uploading file from flash - is it possible?

we have a small flash component on our website/application to upload multiple files.
This works fine, however we want to get the Content-Type from the headers and its always set to 'application/octet-stream'. From what I've learned this is due to a security of flash sandbox and FileUpLoad will never give this to us.
Is there any other way we could do this in flash (aside from creating an html/ajax multi file upload)?
many thanks
We have had a simlar problem when uploading from a browser. What is sent in the content type is dependent upon the browser and what is installed on the client machine. If it is an extension that the client machine does not recognise it will come back as application/octet-stream.
What we ended up doing was creating mapping functionality from the file extension to the content type. That way we could ensure consistency.