HTML Input autocomplete not working in WKWebview - html

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

Related

Sending message from website to Chrome Extension. How am i supposed to know the ID?

In the Chrome documentation, it states here that in your extension manifest, you should add the following:
{
"name": "My externally connectable extension",
"externally_connectable": {
// Extension and app IDs. If this field is not specified, no
// extensions or apps can connect.
"ids": [
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
],
"matches": [
"https://*.example.com/*",
],
},
}
It then goes on to say that to send a message from your website to your Chrome Extension, you need to pass the Extension ID as the first parameter of the sendMessage function
// The ID of the extension we want to talk to.
var editorExtensionId = "abcdefghijklmnoabcdefhijklmnoabc";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
function(response) {
if (!response.success)
handleError(url);
});
Here's the issue. When a Chrome Extension is installed, it is given a random ID by Chrome. For example, in my development build, my PC install has a different ID to my macOS install. As such, the extension only works on the platform with the correct ID.
When I upload the extension to the Chrome store, how am I going to know the ID that it gets given in order to define that ID in my extensions manifest file and on my website?
I figured out how to do this.
What you need to do is to upload your .zip to the Chrome WebStore developer portal.
Once done, at the top is the generated ID that you can hardcode throughout your website or extension.
To then ensure that this ID is always used when developing though, you want to go to the Package section and then download the crx file.
Install that CRX file to your Chrome install, and then navigate to the install folder for that extension:
C:/Users/<User>/AppData/Local/Google/Chrome/User Data/Default/Extensions/<extension-id>/
Open the manifest.json file and inside there is a value called key. If you copy that into your development versions manifest.json, it tells Chrome to always use the ID that the webstore has given it.
Delete the webstore installed version and continue with development
The extension ID will not change after you have uploaded the extension to the Chrome Web Store (CWS). So, you'll only need to use that ID.
For example, Adblock's extension ID is gighmmpiobklfepjocnamgkkbiglidom, which is present on its CWS' link: https://chrome.google.com/webstore/detail/adblock/gighmmpiobklfepjocnamgkkbiglidom.
Yes, it does change every time you load the extension in development mode though.
Your website should attempt to connect to a list of known extension IDs, and use whichever one succeeds. The Chrome Cast SDK does something similar.
This also enables uploading a beta version to the web store with the same codebase; the website will connect to it if that one is installed.
You'll have to upload the extension at least once in order to get an ID, which will remain stable for future versions on the web store.
You could predict the development ID, but you may as well just copy and paste it after Chrome generates it for you.
>>> t=str.maketrans('0123456789abcdef','abcdefghijklmnop')
>>> hashlib.sha256(b'/Users/josh/junk/26053434').hexdigest()[:32].translate(t)
'odalipbppffphnakilnfmbicajbmomim'
>>> hashlib.sha256(b'C:\\Users\\josh\\junk\\26053434').hexdigest()[:32].translate(t)
'ebikiconcdlacnflflaalbbeinepnnmf'
(For example, the windows path might well use forward slashes and begin with file://…)
The actual process to ping the extension could be the same runtime.sendMessage/runtime.connect code, but it could also use web_accessible_resources with either a fetch or a script tag (which is what the Cast SDK does)
If you must access a development extension from a production website, you're going to need some way to inject the extension ID. The simplest might be to pop open the console and write localStorage.myExtensionId='aaabbb' and reloading.

Yii2 html link to open document on external filesystem

I want in Yii2 a simple
[a href="C:/Vo/AGO/2015.pdf">2015 [/a> ([ must be a <)
on one of my forms.
I don't want to upload the file, because the pdf (help) file is updated by an external organisation (instead of C: the pad is a server, but for test reasons I use C:), and I have to display a lot of files managed by that organisation.
So I use:
Html::a("2015", "C:/Vo/Ago/2015.pdf")
When I run the application and I inspect via show source I see
[a href="C:/Vo/Ago/2015.pdf">2015[/a>
But if I click the link on my form, nothing happens!
(When I do the same thing in a simple html document - not yii2 - the pdf opens)
If I copy right-click and copy the link I get:
file:///C:/Vo/Ago/2015.pdf
So, what am I missing?
Yes I'am new in Yii2 and I searched a lot on internet to find a solution.
If this is already asked, excuse me, a reference to the solution would then be welcome...
Thanks,
Chris G.M. Logghe
Because you are trying to link "local" file on browser.
Some browsers, like modern versions of Chrome, will even refuse to
cross from the http protocol to the file protocol, so you'd better
make sure you open this locally using the file protocol if you want to
do this stuff at all.
See here for more details.
The best option for you is to create action on controller and perform download file there.
In your view:
$data = 'C:/data/mydata.log';
echo Html::a('Download', ['sample-download', 'filename' => $data], ['target' => '_blank']);
In your controller:
public function actionSampleDownload($filename)
{
ob_clean();
\Yii::$app->response->sendFile($filename)->send();
}
Of course, you must limit to specific directory rather than user give full access to filename.

How to make XPages application work Offline with HTML 5

I am trying to make an xPages desktop application work offline, the challenge is how to make all the require resource available offline.
i have created the following manifest file and specified the same in pageManifest .
CACHE MANIFEST
#version: 0.0.15.7
jquery-1.10.2.min.js
angular.min.js
/DbPath/Angular.nsf/trashicon.gif
/DbPath/Angular.nsf/editicon.gif
/xsp/.ibmxspres/.mini/css/#Da&#Ib&2Tfxsp.css&2TfxspLTR.css&2TfxspSF.css.css
/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js
/xsp/.ibmxspres/.mini/dojo/.en-us/#Iq.js
/DbPath/Angular.nsf/xsp/.ibmmodres/.css/bootstrap.min.css&custom.css
/DbPath/Angular.nsf/xsp/.ibmmodres/.js/jquery-1.10.2.min.js&bootstrap.min.js&angular.min.js&angularMisc.js
NETWORK:
/xsp/.ibmxspres/
/domjs/dojo-1.4.1/
/domjava/xsp/
I am not sure it is correct, it cache following image / Lib
/DBPath/Angular.nsf/trashicon.gif
/DBPath/Angular.nsf/editicon.gif
/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js
/xsp/.ibmxspres/.mini/dojo/.en-us/#Iq.js
and the main page...
but it does not cache the
/DBPath/Angular.nsf/xsp/.ibmmodres/.js/jquery-1.10.2.min.js&bootstrap.min.js&angular.min.js&angularMisc.js
which is important, may b i am doing it wrong. Also how can we cache the oneui theme .
i am using Angular JS/JQuery which works fine when not cached, but it do not work with the manifest
if their is any simple example please share the link.
What part of the app do you want to make available offline?
If you're using full or partial updates, Server Side JavaScript and other server based stuff it cannot work offline.
Although this refers to Mobile apps it does have a sample showing you how to use HTML5 offline mode in XPages.
http://mobilecontrols.openntf.org
Offline.nsf contains basic HTML5 samples for how to do offline with XPages. MobileControlsOffline.nsf shows how to take a Dojo based mobile app offline.
The definition of a manifest makes an interesting read, as well as the URL document with the section about valid URLS.
As far as I know & is not a valid URL character if is isn't part of a parameter string that starts with ?.
So there are a set of actions you can try:
Switch off js/css combination. Since the files get cached locally anyway you don't benefit from it
Try (it might work) to replace & in the manifest with &
Let us know how it goes.
I did some tests (using Domino Designer) with Firefox and Chrome and it seems that everything can be cached in these browsers. My sugestion:
Instead of
/DBPath/Angular.nsf/xsp/.ibmmodres/.js/jquery-1.10.2.min.js&bootstrap.min.js&angular.min.js&angularMisc.js
Try a relative path without /
xsp/.ibmmodres/.js/jquery-1.10.2.min.js&bootstrap.min.js&angular.min.js&angularMisc.js
I used relative paths everytime. This is the cache manifest file used in my tests (all files were cached successfully):
CACHE MANIFEST
# 2013-01-07 v1.0.0
xsp/.ibmmodres/.js/js%2Fvendor%2Fmodernizr-2.6.2-respond-1.1.0.min.js&js%2Fvendor%2Fjquery-1.10.2.min.js&js%2Fvendor%2Fbootstrap.min.js&js%2Fvendor%2Fhandlebars.runtime-v1.1.2.js&js%2Fplugins.js&js%2Fmain.js
xsp/.ibmmodres/.css/css%2Fbootstrap.min.css&css%2Fbootstrap-theme.min.css&css%2Fmain.css
xsp/.ibmmodres/.js/jquery-1.10.2.min.map
/xsp/.ibmxspres/.mini/css/#Da&#Ib&2Tfxsp.css&2TfxspLTR.css&2TfxspSF.css.css
/xsp/.ibmxspres/dojoroot-1.6.1/dojo/dojo.js
/xsp/.ibmxspres/.mini/dojo/.es-es/#Iq.js
/xsp/.ibmxspres/.mini/dojo/.es/#Iq.js
NETWORK:
*

HTML5 read files from path

Well, using HTML5 file handlining api we can read files with the collaboration of inpty type file. What about ready files with pat like
/images/myimage.png
etc??
Any kind of help is appreciated
Yes, if it is chrome! Play with the filesytem you will be able to do that.
The simple answer is; no. When your HTML/CSS/images/JavaScript is downloaded to the client's end you are breaking loose of the server.
Simplistic Flowchart
User requests URL in Browser (for example; www.mydomain.com/index.html)
Server reads and fetches the required file (www.mydomain.com/index.html)
index.html and it's linked resources will be downloaded to the user's browser
The user's Browser will render the HTML page
The user's Browser will only fetch the files that came with the request (images/someimages.png and stuff like scripts/jquery.js)
Explanation
The problem you are facing here is that when HTML is being rendered locally it has no link with the server anymore, thus requesting what /images/ contains file-wise is not logically comparable as it resides on the server.
Work-around
What you can do, but this will neglect the reason of the question, is to make a server-side script in JSP/PHP/ASP/etc. This script will then traverse through the directory you want. In PHP you can do this by using opendir() (http://php.net/opendir).
With a XHR/AJAX call you could request the PHP page to return the directory listing. Easiest way to do this is by using jQuery's $.post() function in combination with JSON.
Caution!
You need to keep in mind that if you use the work-around you will store a link to be visible for everyone to see what's in your online directory you request (for example http://www.mydomain.com/my_image_dirlist.php would then return a stringified list of everything (or less based on certain rules in the server-side script) inside http://www.mydomain.com/images/.
Notes
http://www.html5rocks.com/en/tutorials/file/filesystem/ (seems to work only in Chrome, but would still not be exactly what you want)
If you don't need all files from a folder, but only those files that have been downloaded to your browser's cache in the URL request; you could try to search online for accessing browser cache (downloaded files) of the currently loaded page. Or make something like a DOM-walker and CSS reader (regex?) to see where all file-relations are.

Rules for making a clickable link to install an extension in chrome?

I have finished an extension for my company and I want to put it on the company wiki so that in order to get it on everyone's machine all I have to do is go around and click the link.
First, I HAVE READ all the documentation from http://developer.chrome.com/extensions/hosting.html about hosting and autoupdating and all that. Part of it confuses me and I can't find any more information about this:
Google Chrome considers a file to be installable if either of the following is true:
The file has the content type application/x-chrome-extension
The file suffix is .crx and both of the following are true:
The file is not served with the HTTP header X-Content-Type-Options: nosniff
The file is served with one of the following content types:
empty string
"text/plain"
"application/octet-stream"
"unknown/unknown"
"application/unknown"
"*/*"
This looks like it wants a MIME style setup? but I have never done anything with this. I have the ability to change what I want to the Locally hosted Wiki, all I need is to understand what need to change to make the link installable. I will keep looking for examples.
Note: The reason it is not going on the app store is that there is really no reason to. It is branded for our company, and communication with our specific servers is hard-coded into it.
In version 21 (or so), Chrome disabled the ability to do a simple link-click install of off-store extensions. There is a discussion of the change in this bug report:
You are no longer supposed to be able to install extensions off-store in Chrome... In order to install off-store extensions, the user must download them to a directory and drag them onto chrome://extensions/.
There is, therefore, no longer any way to install an extension simply by clicking a link, except by hosting it in the Web Store. You will need to download the file and then drop it into chrome://extensions.
The documentation you reference looks out of date (that's Google's fault, not yours). It definitely fails to mention the new drag-and-drop requirement. It also talks about the file's "content type" and the X-Content-Type-Options HTTP header required to make the CRX installable; however, when you install an extension by dropping it into chrome://extensions, I doubt very much that Chrome remembers what HTTP headers were set when you first downloaded the file.
EDIT: You can also use the --enable-easy-off-store-extension-install command line flag to restore the old instalation behavior.
You can do an "inline install" of an app hosted on the web store. The new changes are forcing people to move our extensions to the web store, but the inline installation should allow your users to not need to leave your page to install.