I get a weird error when I try to ask for permissions for displaying desktop notifications on Safari I get a typeError. I got a button which triggers `window.webkitNotifications.requestPermission()' onclick.
HTML Code:
<button id='btn'>Request Permissions</button>
Javascript:
var btn = document.getElementById( 'btn' );
btn.onclick = function () {
window.webkitNotifications.requestPermission();
}
This snippet works fine on Chrome, but on Safari throws a typeError.
The website runs on localhost.
Related
I am having an issue with chrome on https connection related to MouseEvent isTrusted property.
I have an HTML like
<div id="facebook_share">
<a href="#">
<img src="facebook.png" alt="facebook">
</a>
</div>
Now I am opening a popup with facebook url using following javascript
socialSharePopup = function (link, title) {
window.open(link, title, 'width=400,height=380');
};
documentUrl = document.URL;
documentMetaDesc = getMetadata("description");
facebookLink = "https://www.facebook.com/sharer/sharer.php?u=" + documentUrl;
facebookLinkEle = document.getElementById("facebook_share");
if (facebookLinkEle !== null) {
facebookLinkEle.onclick = function (event) {
//event.isTrusted is false on chrome on https
socialSharePopup(facebookLink, 'Facebook');
if (event) { //If Condition used for IE8
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
}
};
}
Now the issue I am facing is, on chrome when this page is opened on https connection then a popup blocker is opened first time and popup opens when clicked second time without making any changes. I find this behavior weird.
When the same site is opened on http connection then it working fine and no popup is blocked.
Same result happens when website is opened on https with untrusted connection (on local with no certificate)
Upon debugging I find that MouseEvent.isTrusted (event.isTrusted) property is false in case of popup is blocked on https
What is the relation between isTrusted and https connection ? Why its false only on https ? And why only first time ?
Its working fine on Firefox and IE
One more observation is that when user clicks happens on div#facebook_share it works fine (event.isTrusted is true) but when click happens on <a> tag its false.
Removing <a> tag is not an option as HTML is dynamically generated
How can this issue be resolved ?
Why is google reCaptcha2 (gReCaptcha) not showing after a page refresh, but showing if page is reopened by the link?
See this video for explanation: http://take.ms/I2a9Z
Page url: https://orlov.io/signup
Page first open: captcha exists.
Navigate by link: captcha exists.
Open new browser tab: captcha exists.
Refreshing page by refresh icon, ctrl+R, ctrl+F5: captcha NOT exists.
I added body unload event to prevent browser cache, it did not help.
Browsers for testing:
Firefix 39.0
Chome: 44.0.2403.125 m
Opera: 30.0
In all browsers I get the same result. So does this mean there's an error on my side?
I think it has to do with the browser and the speed of your network. You are calling ReCaptcha with a callback, but you call it before you define the callback. Depending on your network speed or browser quirks, it might execute before the rest of the script has loaded.
Line 330:
<script src="//www.google.com/recaptcha/api.js?onload=renderReCaptchaCallback&render=explicit&hl=en-US" async defer></script>
Line 351:
<script type="text/javascript">if (typeof (renderReCaptchaCallback) === "undefined") {
var reCaptchaWidgets = {};
var renderReCaptchaCallback = function() {
jQuery.each(reCaptchaWidgets, function(widgetId, widgetOptions) {
grecaptcha.render(document.getElementById(widgetId), widgetOptions);
});
};
}</script>
So I would move the definition of renderReCaptchaCallback to the top of the page so it is defined well before trying to load it.
Environment specifics:
MVC4 app
Kendo UI File Upload
IE 11 (or 10)
Windows Authentication
When I load the view for the application that has the file upload kendo tool in IE the file upload returns a 401 unauthorized error (traced from server). If I refresh the page (ctrl-F5) then the tool works fine. This tool works fine with Chrome.
any idea why or how to fix?
you will not believe the insanity I had to go through to get a solution to this:
I dropped a document ready jquery snippit at the end of the document to force it to authenticate an action on my controller.
<div id="checkauth" style="display: none;"></div>
<script type="text/javascript">
$(function () {
$.ajax({
url: '\AcceptanceFileValidator\CheckAuth'
}).done(function (d) {
$('#checkauth').html(d.uid)
});
});
</script>
and on the controller:
public JsonResult CheckAuth()
{
return Json(new { uid = Guid.NewGuid().ToString() }, JsonRequestBehavior.AllowGet);
}
I have the following code to load a file after creating a web page which displays a WebGL canvas:
// Load ccconnect.js file
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4){
eval.call( Window, xmlhttp.response );
}
};
xmlhttp.open("GET","../ccconnect.js",true);
xmlhttp.send(null);
It works fine in Chrome but Safari brings up an error saying:
ReferenceError: Can't find variable: Window
on the line eval.call(...). The ccconnect.js code is displayed when I hover the mouse over 'response' on that same line when debugging so it seems to have retrieved it. Any idea what is wrong? I'm using Safari 5.1.5.
both window and Window is the global object both are understand by other browsers.
but when I checked in safari, it don't understand the variable Window. So my suggestion is replace Window with window.
I am having a problem connecting to a java application using my opera extension
I already did this extension in chrome a it work.
this is the code in javascritp in the popup.html
function AtribuirID(){
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var texto = xmlhttp.responseText;
var splitagem=texto.split("(user)");
localStorage.setItem('ID',splitagem[0]);
localStorage.setItem('Auxiliar',splitagem[1]);
}
}
xmlhttp.open("GET","http://localhost:10002?z=AtribuirID",true);
xmlhttp.send();
}
The problem is that i am getting a error Uncaught exception: DOMException: NETWORK_ERR in xmlhttp.send() and i cant access my application in java that suppose to be the server part.
I have already put the network="public private" in the config.xml but it didnt work
in config.xml file add this line: <access origin="*" subdomains="true"/> to allow any domain httprequest before </widget> tab, this solve the problem, if problems persist, open in opera browser tab "opera:config" and select "Users Prefs" and check "Allow File XMLHttpRequest" and restart. if have problem i can send you my opera extension working fine...