Recently I heard that Microsoft Edge mobile supports Web Notifications after the Windows 10 Anniversary Update. So I tried the following code but it didn't work.
if ( window.Notification && Notification.permission !== "denied" ) {
Notification.requestPermission( function( status ) { // status is "granted", if accepted by user
var n = new Notification('Title', {
body: 'I am the body text!',
icon: '/path/to/icon.png' // optional
});
});
}
I am on Windows 10 mobile using Edge 38.14393.67.0, and EdgeHTML 14.14393.
I tried to use it too, and I get instant denied response. I've made a ticket about this in the feedback hub.
(Update)
I've found their answer here. https://github.com/MicrosoftEdge/MicrosoftEdge-Documentation/issues/62
So yes, it would be quite limited, but still. They say it's supported.
https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webnotifications/
Related
I have an ionic 3 project that allows for file upload to the server. The following code is working fine from Android. But on iOS it appears to get blocked (i.e. the server code at /upload.php is obviously the same in both cases, but coming from iOS it does not receive any of the posted data).
this.http.setDataSerializer('urlencoded');
this.http.post("http://example.com/upload.php", {
name: this.filename,
data: this.datafile
}, {"Content-Type":"multipart/form-data"})
.then(res => {
console.log('success response: ' + res.data);
}, error => {
console.log(error: ' + error);
});
Any ideas?
Is there some setting in xCode that needs to be configured to allow multipart/form-data posts to work? Or perhaps somewhere to white list the domain to allow it?
Turned out to be on the server side. Apparently PHP receives the post differently from Android as it does iOS. $_REQUEST["xxxx"] works fine for Android but in order to work for both it required this:
$postdata = file_get_contents("php://input");
parse_str($postdata, $param);
// then available as $param["xxxx"]
Thought I'd update the answer here in case anyone else bumps into this. Awfully obscure and took me days to figure out!
It been two days I'm working with twitter and google plus Signup/Signin but unfortunately unable to hit it.
For twitter, I tried Aaron K Saunders's test app https://github.com/aaronksaunders/test_social. It says "You've granted access to your app. Next, return to your app and enter this PIN (XXXXXXX) to complete authentication process". What really is that??? I'm confused in it.
For google plus, I tried Google Auth for Titanium test app https://github.com/ejci/Google-Auth-for-Titanium. But it shows simple white screen.
I'm stuck into both of these. Can anyone please help. I'd be grateful.
Thanks a lot!!
I believe you posted this issue on Test Social's GitHub page? Here's what I had to do to get Twitter working on Android - Test Social still works as intended on iOS.
"I have the same issue (Android only, iOS still works as before). This is an issue with Android, not this module. Here is how I go about fixing this on Android.
getHtml on the webView is returning null in Android, but again fine in iOS - Just putting this out there in case anybody runs into this error. Doesn't seem to be a fault of this module.
I modified the authorizeUICallback function inside Test Social:
function authorizeUICallback(e) {
var promptView = Ti.UI.createView({
width:'30%',
height:'10%',
layout: "vertical",
backgroundColor:'black',
bottom:"20%"
}),
pinField = Ti.UI.createTextField({
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
hintText: 'Enter PIN'
}),
pinButton = Ti.UI.createButton({
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
title: "Authorize"
});
promptView.add(pinField);
promptView.add(pinButton);
view.add(promptView);
pinButton.addEventListener('click', function() {
if (!pinField.value) {
alert('No PIN found');
} else {
pin = pinField.value;
response = 1;
response ? ( pin = pinField.value, /*pin = response.split("<code>")[1].split("</code>")[0]*/ destroyAuthorizeUI(), receivePinCallback()) : (loadingView && loadingView.hide(), loadingContainer && loadingContainer.hide(), webView && webView.show()), loading = !1, clearInterval(intervalID), estimates[estimateID] = (new Date).getTime() - startTime, Ti.App.Properties.setString("Social-LoadingEstimates", JSON.stringify(estimates));
}
});
}
There was another issue created on the GitHub page and they haven't found a solution either. This seems to be the only way to get Twitter to work with Test Social (or the ONLY way I've found to get it to work with Appcelerator at all).
I can't help you with Google+ just yet. I'm looking to implement that later, but it's not super high on my priority list with their recent changes... Who knows how much longer people will be using it, but I digress... Are you getting any kind of error in the console when you get a 'white screen'?
This simple code works perfectly everywhere except Microsoft Edge:
link
[JSFiddle]
In Microsoft Edge I'm getting "That's odd...Microsoft can't find this page" error:
Examples from Mozilla documentation also do not working with the same result.
Here's the output from Edge console:
This error occurs when opening a new edge window, on new tabs it inputs data:text/plain;charset=utf-8,Test as search query into the default search engine.
It seems like Microsoft Edge has no definition for data:
Does anyone know a solution to this?
Update: unfortunately, it seems that there's no way to use data URI in links in IE/Edge. I've created related question about detecting data URI support in links: Detect data URI in links support with Modernizr
As of 2020, the new Microsoft Edge built on Chromium supports navigating to data URIs in the address bar like the other Chromium-based browsers. Neither IE nor Microsoft Edge Legacy support this feature; MSDN claims that this is for security reasons.
The only solution for older Microsoft browsers is to link, using a scheme that is supported such as file:// or http://, to some resource that contains the content.
Interestingly enough, the oldest versions of IE (I'm talking older than 6) supported a precursor to data URIs in the about: URI scheme, though only HTML was supported this way. Those URIs no longer work today and simply redirect to "Navigation canceled" (previously "Action canceled") or, in the case of the new Microsoft Edge, are treated as invalid edge:// URIs.
You can try using navigator.msSaveBlob in order to download the data URI in IE/Edge:
var a = document.getElementsByTagName('a')[0];
a.addEventListener('click', function (e) {
if (navigator.msSaveBlob) {
var bytes = atob(a.href.split(',')[1]), array = [];
for(var i = 0; i < bytes.length; i++) array.push(bytes.charCodeAt(i));
navigator.msSaveBlob(new Blob([new Uint8Array(array)], {mime: "text/plain"}), "file.txt");
e.preventDefault();
}
});
Since IE and Edge do support <img> tags with a data URI as the source, you can fudge a link to an image using javascript to write to the document:
<a href="javascript:document.write('<img src=data:image/png;base64,iVBORw0KGgoAA
AANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0l
EQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6
P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC />')">link</a>
Is there any way to fetch user’s phone number in Firefox OS?
If so, any help would be appreciated.
According to Mozilla's app permissions page, there is an permission called "phonenumberservice" but there is no information about it. Anyway, the permision is listed under the "Internal (Certified) app permissions", which means that, when available, it can only be used by "system-level apps and default apps created by Mozilla/operators/OEMs".
With Firefox 2.0 you should be able to use Mobile Identity API:
https://wiki.mozilla.org/WebAPI/MobileIdentity
https://bugzilla.mozilla.org/show_bug.cgi?id=1021594
I believe the permission is:
"permissions": {
"mobileid": {} }
And it is privileged.
So, as #Jason said, the Mobile Identity API provides this capability, and not just for certified, but for privileged applications. So it is no longer just for OEMs.
The Mozilla Wiki site shows the API:
dictionary MobileIdOptions {
boolean forceSelection = false;
};
partial interface Navigator {
Promise getMobileIdAssertion(optional MobileIdOptions options);
};
The site also provides a sample code skeleton for this:
function verifyAssertion(aAssertion) {
// Make use of the remote verification API
// and return the verified msisdn.
// NB: This is necessary to make sure that the user *really* controls this phone number!
}
// Request a mobile identity assertion and force the chrome UI to
// allow the user to change a possible previous selection.
navigator.getMobileIdAssertion({ forceSelection: true })
.then(
(assertion) => {
verifyAssertion(assertion)
.then(
(msisdn) => {
// Do stuff with the msisdn.
}
);
},
(error) {
// Process error.
};
);
For this to work, you need to add the mobileid permission in the manifest file, for example like this (I made up the description):
"permissions": {
"mobileid": {
"description": "Required for sending SMS for two factor authentication",
"access": "readonly"
}
}
PS: I made this answer, because most answers are outdated, and the one that isn't, does not contain all useful information.
References:
App Manifest Documentation
Firefox Remote Verification
Greetings Everyone,
I am creating a web application that uses the Geolocation API to locate the end user. It works great on almost every platform I can think of except for Internet Explorer 9. Things get a little stranger though. If I have my Google Toolbar loaded into my Internet Explorer browser window, everything sails smoothly. Here is the offending chunk of code that I have been working with:
if (navigator.geolocation) {
var locationMarker = null;
navigator.geolocation.watchPosition(
function( position ){
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
if (!locationMarker) {
locationMarker = addMarker(
position.coords.latitude,
position.coords.longitude,
"Initial Position"
);
}
else{
updateMarker(
locationMarker,
position.coords.latitude,
position.coords.longitude,
"Updated / Accurate Position"
);
};
map.setCenter(point);
if (map.zoom < 17){
map.setZoom(17);
};
},
function( error ){
console.log( "Something went wrong: ", error );
},
{
timeout: (5 * 1000),
maximumAge: (1000 * 60 * 15),
enableHighAccuracy: true
}
);
}
else {
alert("Geolocation is not supported by this browser");
}
Whenever I access my application with Internet Explorer 9 I get the "Geolocation is not supported by this browser" alert. That is unless I have my Google Toolbar active. If the Google Toolbar is active however, then the Google Toolbar handles the permissions.
How do I get geolocation to work in IE9? My application works flawlessly in Safari, Firefox, Chrome, iOS and Android. I am totally stumped.
Thanks, Tyler Waring
user1303379,
IE9 and IE10 both support geolocation, however earlier versions of IE do not support it ( reference http://caniuse.com/#feat=geolocation ). Here is a blog post by IE about geolocation in IE9 http://blogs.msdn.com/b/ie/archive/2011/02/17/w3c-geolocation-api-in-ie9.aspx and here is a test page using navigator.geolocation.watchPosition like you are above.
For browsers that don't support geolocation you may consider using one of the geolocation polyfills listed here https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
IE9 & IE10 ask the user if they would like to share their location http://cl.ly/image/0X0o2F0s1N03 My guess is that you may have denied access to your location at some point.
The Google Toolbar added a feature to determine geolocation back in the IE8 days http://googletoolbarhelp.blogspot.com/2010/02/google-toolbar-6413211732-for-ie.html From what you describe it sounds like the Google Toolbar started to provide geolocation since the native IE9 geolocation was denied access.