Console Error in Fullpage JS for html5 video - html5-video

i am getting error in console "Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first." in jquery.fullPage.js:1645 . i am using html5 video in my page and video is loading after some refreshes, sometimes video don't load. Anyone have some idea why its happening? where i am making mistake?
if( element.hasAttribute('data-autoplay') && typeof element.play === 'function' ) {
element.play(); //this is where i am landing when click on console error
}

Related

How to show custom notifications or error message at admin panel for prestashop 1.7.7.7?

​
Hi, 
I've been trying a lot of options to manage an exception and show an error at admin panel but nothing seems to work.
I'm at the postProcess method of a custom module. After the user sends a csv file through a form and the data is checked (everything works fine here), if an exception occurs I need to show a message, stop and redirect to the same page. 
I've tried this: 
this->get('session')->getFlashBag()->add('error',$msg);
Tools::redirectAdmin('index.php?controller='.$controller.'&token='.$token);
this: 
header("HTTP/1.0 400 Bad Request");
die(json_encode(array( 'error' => array($this->l(' Error') ))));
(that one works but shows a blank page with the message, not the message inside the admin panel) 
also this: 
$this->context->smarty->assign(array(
'token' => Tools::getAdminTokenLite('AdminModules'),
'errors' => $this->errors
));
$this->setTemplate('ExcelProcess.tpl');
and {$errors|var_dump} at the tpl displays null...
... and many other options. 
I can't find anything either about backoffice custom notifications at the PS docs, only about front custom notifications.
Any clue? 
 
Thanks a lot! 
Miguel
PostProces code: https://drive.google.com/file/d/175nhUPDlzi6T8rZjjE8Desnzq-mtYzNQ/view?usp=sharing
​Tpl code: https://drive.google.com/file/d/17EONOCJ60L4Gp_GidzvwCQwMyTrRXapF/view?usp=sharing
Adding an error in postProcess() can be achieved by setting
$this->errors[] = $this->l('My error');
or
$this->context->controller->errors[] = $this->l('My error');
during your form submission checks.
Form will be rendered with your error messages into a red box.
If you want to show an alert without reloading the page instead, you'll have to perform an AJAX call to your AdminController, get back a JSON response and render your error message as a result of the execution of the call.
See offical docs

Titanium evalJS slows loading of the webview - timeout waiting to evaluate js

I am developing Titanium application with a webview that is loading content from a remote url. In the load event I am injecting some code with evalJS. Using Titanium SDK 8.0.0+ the loading of the webview content is very slow because of evalJS, I need to wait for some time in order to scroll or click something. I can see in the console that there is a warning repeatedly saying "TiWebViewBinding: (main) [4405,4881] Timeout waiting to evaluate JS", and when this warning stops showing I can interact with the webview. If evalJS is not used meaning I am not injecting code, there is no problem. The webview is loaded properly and there is no warning saying "Timeout waiting to evaluate JS". Before 8.0.0 sdk the problem did not existed. Has anyone had an experience with an issue like this? Am I missing something?
I would be very grateful if I get some input on this. Thanks.
var webview = Ti.UI.createWebView({
width : Ti.UI.FILL,
height : Ti.UI.FILL,
url : "remote url"
});
webview.addEventListener('load', function() {
webview.evalJS('(function() {alert("test");})();');
webview.evalJS('(function sum(val1, val2){return val1 + val2;})();');
});
window.add(webview);
window.open();

reCAPTCHA not showing after page refresh

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.

PDF .js not loading first page in Safari

I managed to get pdf.js working in chrome and other browsers. However it doesn't seem to be loading properly in Safari. Safari doesn't load the first page of the PDF files. I've not modified any code in the pdf.js library. Any help?
Apparently there was an:
Warning: Unhandled rejection: ReferenceError: Can't find variable: MozBlobBuilder
This occured because in the webkit version the typeof Blob === "object" when there is an image in the pdf being displayed and not the default (typeof Blob === "function"). To fix this issue we had to replace this line in util.js with (typeof Blob !== 'undefined')

XMLHttpRequest not working properly in Safari (but works with Chrome)

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.