javascript and jquery not working on chrome android html5 - javascript

I have a problem on Chrome on Android OS.
I work with a html5 page with jQuery and javaScript.
I have select box , number input .. etc.
When i try to "click", I have:
var hitEvent = 'ontouchstart' in document.documentElement ? 'touchstart' : 'click';
on a input or select nothing happens.
However when i do an alert("something") everything starts working.
On every browser works ok (Safari , Chrome on iPad,iPhone... ; Firefox , Internet Browser on Android) but not Chrome on Android.
Do you have any idea on how to solve this problem?

Normally when everything works after you put an alert,
that means there is a problem in a asynchronous call.
What is happening is that the alert is giving time for the page to really load or an event to actually happen. when you don't put an alert, an action is happening before the event
(for example an element is being called before it is generated)
Search in this perspective.
If it's working in Firefox, it is by pure luck from the way firefox is rendering the page, but still you have to fix your error.

Related

Javascript code inside beforeunload callback not working in Safari

I have added code to change web page color on beforeunload event:
window.onbeforeunload = function (){
$('.navbar-collapse').css({background: 'blue'});
console.log("Hello unload");
return null;
}
This code works properly on Chrome and Firefox but it doesn't work on Safari browser.
However, when I debug this code in Safari, when stepping over each line of code in the callback function, id DOES changes background color.
When I navigate by clicking on an url on page and then click back button on browser, the background color is changed.
Any idea?
window.onbeforenload is "magic" in the sense that it is special and more and more browsers are restricting what it can do.
Some browsers will let you display a custom message, other browers are free to ignore this event entirely.
In short: Don't try to do anything but return a null or non-null value and hope for the best. It is out of your hands.
You might want to see this answer too: window.onbeforeunload and window.onunload is not working in Firefox , Safari , Opera?

Internet Explorer Javascript not running from event issue

I am trying to get an function to run from an event listener on a form submit.
Chrome & Firefox (Iceweasel) work fine with this code. Internet explorer (Version 9) for some reason requires me to open up the developer tools and close it down straight away for the javascript to work, after the page can be refreshed and the code works fine.
The site is published at http://itdipext.ryanteck.org.uk/enquire.html and the javascript is at http://itdipext.ryanteck.org.uk/javascriptValidate.js
Why Internet Explorer 8?, Heck why javascript for basic form validation?
This is for a college assignment where HTML5 does not even exist yet. And internet explorer to make the teacher happy.
Thanks -
Ryan Walmsley
It looks like its due to the heavy use of console.log in your script.
IE doesn't create the console object until dev tools is open. You can add this to the top of your script to stop it breaking
var console=console||{"log":function(){}};
Be aware it wont log anything to the console with this in place.

JQuery Mobile - history back breaks firefox

So I'm working on a big system using JQM and the problem I'm running into is that after I use a history.go(-1) to change page (with a cancel button) firefox breaks entirely. All pages on all open firefox windows and tabs no longer display correctly, and some of the UI buttons are even becoming more transparent. The page that I transition to has all coloration replaced with solid black. I don't know what to do to debug this because I don't know what's actually happening here. Could someone possibly explain what's happening to firefox?
Note: I have attempted to pick up an error message in the console, but when the firefox javascript console is open, the bug stops happening.

IE Chrome Frame Full Screen

I have a working implementation of full screen working for Safari, Firefox, and Google Chrome. From what I have read it should work for ie with google chrome frame but when I click the full screen button I created nothing happens. Any ideas? Is it not yet supported?
$('#enable_fullscreen').click ->
calculate_presentation_font_size(height)
if docElm.requestFullscreen
docElm.requestFullscreen()
else if docElm.mozRequestFullScreen
docElm.mozRequestFullScreen()
else if docElm.webkitRequestFullScreen
docElm.webkitRequestFullScreen()
Putting an alert in the "webkitRequestFullScreen" if statement shows that it does go to this condition in chrome frame but docElem.webkitrequestFullScreen() is undefined.
I've build it and made it work from this examples.
https://developer.mozilla.org/en-US/docs/DOM/Using_full-screen_mode
The only things I can see missing from your code for the webkit condition is the parameter "Element.ALLOW_KEYBOARD_INPUT" to the webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)
Unfortunately the main problem of chrome frame is the communication with the IE window that literally behave like a difficult child ;-)
For IE you can open a popup window in fullscreen mode by directly calling document.location.href for the source it will open the current page your are on
window.open(document.location.href, 'myAppfullscreen', 'fullscreen=1');

I have a very Unique issue with IE 7/8/9 and JavaScript Jquery

I have a very Unique problem with IE 7/8/9 and JavaScript. My problem is I am using a script called plupload - I am kinda married to the script currently and can't ditch it for something new and or better.
What my problem is, is when I add files to the script via the file dialog in IE and hit cancel instead of selecting a file. The button (well link that forms a button) seems to lose its functionality. This is only in IE, this has been tested across Mac, Linux 10.04 and 11.10, Windows XP, Vista, and Windows 7 (across about 17 different machines). On Chrome, Safari, Firefox and IE. This bug only occurs in IE on any windows platform. Does anyone know what might be causing the issue, anyone else ever use plupload that has experianced this?
To me it seems that the dialog takes focus off the browser, then doesn't give the the browser back focus properly unless you actually select a file. Seems at that point almost all javascript stops working but its really just the javascript that controls this button, which is pluploads own script.

Categories