I'm having no luck with this at all. Basically the logo shows the static default instead of the animated for IE10. Having no issues with any other browser on this.
The logo animation was created using an export from Adobe CS6.
Site: http://barn2media.co.uk/northbromsgrove/
Code:
<script>
// Animated Logo
var canvas, stage, exportRoot;
function init() {
canvas = document.getElementById("canvas");
images = images||{};
var manifest = [
{src:"images/bg.png", id:"bg"}
];
var loader = new createjs.LoadQueue(false);
loader.addEventListener("fileload", handleFileLoad);
loader.addEventListener("complete", handleComplete);
loader.loadManifest(manifest);
}
function handleFileLoad(evt) {
if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
}
function handleComplete() {
exportRoot = new lib.north6copycs6450();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
createjs.Ticker.setFPS(35);
createjs.Ticker.addEventListener("tick", stage);
}
</script>
Hoping somebody can help, many thanks.
Check if IE is set to "Compatibility mode" by pressing F12 and looking in the top right. If so, set it back to regular IE10 mode.
Finally figured out why the logo defaulted to the static image in IE10 but not IE9... It was a PHP issue.
Basically, in order to get the static image to display a selection of images (dependant on the page) in IE8, I used the following to show a static image if the user was browsing in IE8 or below :
if ( preg_match("/(?i)msie [1-8]/",$_SERVER['HTTP_USER_AGENT'])) {
echo 'IE 8 and below image here';
} else {
echo 'IE 9 and above here';
}
THE SOLUTION
Apparently by not adding the \./ after the 1-8 reference, this code included IE10 in the default output.
if ( preg_match("/(?i)msie [1-8]\./",$_SERVER['HTTP_USER_AGENT'])) {
echo 'IE 8 and below image here';
} else {
echo 'IE 9 and above here';
}
Related
In my Cordova based iOS app, when I am trying to navigate to next screen from home page ,It is remaining in Home page in iOS 9 where as navigation working fine with iOS 8.4 and below.
Here is the path in iOS 8.4(working fine)
file:///var/mobile/Containers/Bundle/Application/EABC-4728-97BF-466B/MyApp.app/www/index-telugu.html#publicinterface
Here is the path in iOS 9.0 which is different from supposed path
file:///var/mobile/Containers/Bundle/Application/47CF-A77E-97ACED384A/MyApp.app/www/index-telugu.html#main
If anyone facing the similar issue Please suggest me the way to solve this
Here is my code:
$('#publicinterface_main_id').click(function()
{
if (!checkConnection())
{
navigator.notification.alert('Please Check Your Internet Connection');
}
else if (!navigator.geolocation)
{
navigator.notification.alert('Please switch on location settings on your mobile');
}
else
{
window.location.href = "index-telugu.html#"+$(this).attr('reloadIndex');
console.log("Path for navigation: : " + window.location.href );
location.reload();
navigator.geolocation.getCurrentPosition(function (p)
{
getAddress(p.coords.latitude,p.coords.longitude);
$('#pub_HgeoLocation').val(p.coords.latitude+","+p.coords.longitude);
});
var places = new google.maps.places.Autocomplete(document.getElementById('pub_geoLocation'));
google.maps.event.addListener(places, 'place_changed', function ()
{
var place = places.getPlace();
var address = place.formatted_address;
var longitude = place.geometry.location.lng();
var latitude = place.geometry.location.lat();
$('#pub_HgeoLocation').val(latitude+","+longitude)
});
}
});
A bug/"feature" of the iOS 9.0 UIWebView (used by Cordova/Phonegap) is that setting of window.location.hash is asynchronous - see this bug report for details. Note that Safari on iOS 8+ uses WKWebView not UIWebView, so this issue is not evident in the Safari browser on iOS 9.0
console.log(window.location.hash); // -> "#bar"
window.location.hash = '#foo';
console.log(window.location.hash);
// -> "#bar" // iOS 9.0 UIWevView
// -> "#foo" // iOS 9.0 WKWebView (Safari) and all other known browsers except
// in all other known browsers at this point window.location.hash will read '#foo'. In iOS9 UIWebView it won't.
if(window.location.hash !== '#foo') {
// bang: iOS 9 webview
} else {
// ok: any other browser
}
As a workaround, you can try using window.setTimeout to make operations following setting the value window.location.hash asynchronous, allowing for the value to be applied before you use it. So using your code above, try something like:
window.location.href = "index-telugu.html#"+$(this).attr('reloadIndex');
window.setTimeout(function(){
console.log("Path for navigation: : " + window.location.href );
location.reload();
},0);
Well I have a scene and I add some fog to it and the result is the fog is filling my entire screen with that color, like having a plain black background.
Chrome version: 39.0.2171.93
Mobile device: nexus 5
Android: lolipop
Here is my code:
Demo.prototype.initializeScene = function( settings ) {
var defaults = {
fogColor: 0x000000,
fogIntensity: 0.0005,
near:50000,
far:120000
};
this.options.scene = $.extend(true, defaults, settings);
this.scene = new THREE.Scene();
this.scene.fog = new THREE.FogExp2( this.options.scene.fogColor, this.options.scene.fogIntensity );
}
The code works fine on desktop and other mobile devices.
If I remove the fog everything seems to work great.
Furthermore everything takes place inside a dome (json) mesh created with blender and then loaded, here is the code in case it's a material issue.
Demo.prototype.initializeEnvironment = function() {
var that = this;
loadMesh("geometry/dome.json", function(geometry, materials) {
var materials = [
new THREE.MeshLambertMaterial({ color: 0x3333ff, shading: THREE.FlatShading, overdraw: false}),
new THREE.MeshLambertMaterial({ color: 0x2e2eff, wireframe: true})
];
that.dome = new THREE.SceneUtils.createMultiMaterialObject(geometry, materials);
that.dome.position.set(0,0,0);
that.dome.scale.set(500,500,500);
that.scene.add(that.dome);
});
}
Finally the renderer code:
Demo.prototype.initializeRenderer = function( settings ) {
var defaults = {
init :{
antialias: true,
alpha: true,
autoClear: false
},
clearColor: 0x000000,
clearColorIntensity: 1
};
this.options.renderer = $.extend(true, defaults, settings);
this.renderer = new THREE.WebGLRenderer( this.options.renderer.init );
this.renderer.setClearColor( this.options.renderer.clearColor, this.options.renderer.clearColorIntensity );
this.renderer.setSize( this.options.generic.container.clientWidth, this.options.generic.container.clientHeight );
this.options.generic.container.appendChild( this.renderer.domElement );
}
I am using Three.js r73 and hit the same issue on my Nexus 4 with Android 5. Fog seems to work again after disabling antialiasing.
You can achieve the same anti-aliasing effect by setting the renderer's pixelRatio. Here's what I do:
renderer.setPixelRatio((window.devicePixelRatio || 1) * 2);
Trying to fix a really annoying problem that I'm having. I have an HTML5 canvas that I'm allowing users to draw on, which is loaded in an iframe. When the page first loads, it checks to see if we're on a mobile device and, if so, it resizes the whole page, including the iframe. I then have a setTimeout that runs every few seconds to check and see if my canvas is a different size from the frame it's loaded in. If it's different, I change the canvas size and then reinitialize it (using Kineticjs 1.0, I know there are newer versions but we're not ready to upgrade).
This works in most of the mobile browsers that we test, but Chrome (on iOS and Android) doesn't allow drawing on the canvas either when the page is first loaded in portrait or after an orientation change. It just scrolls the page (standard touch event) and ignores all of my preventDefaults. I can't even get it to do an alert on touchstart after the orientation changes.
Has anyone run across this before? I'm thinking it's either something with the fact that the canvas itself is changing or that maybe once the new stage(canvas) is created in Kinetic all of the defined listeners become ignored.
Update:
Here's some of the code I'm dealing with:
// This page is loaded in a frame, so we check to see when the parent is loaded
parent.$(document).ready(function()
{
$(document).ready(function()
{
ut();
setTimeout('start_orientation_detect_timer()','2000');
});
});
function start_orientation_detect_timer()
{
if(document.getElementById("data").value.length == 0 && Math.floor(canvas.width) != Math.floor(parent.$(parent.top_origin.frame_array['sig_block_frame']).width()) || Math.floor(canvas.height) != Math.floor(parent.$(parent.top_origin.frame_array['sig_block_frame']).height()))
{
if(top_origin.misc_variables.mobile_device !== false && top.window.orientation == 0)
{
parent.$('#flip_to_landscape_msg').show();
parent.$('#flip_to_landscape_msg').effect("pulsate", { times:200 }, 2000);
}
else
{
parent.$('#flip_to_landscape_msg').stop(true, true);
parent.$('#flip_to_landscape_msg').hide();
}
ut();
}
else
{
// so from this frame several deep, we need to know the orientation, which will only be in the top of the DOM
if(document.getElementById("data").value.length == 0 && top_origin.misc_variables.mobile_device !== false && top.window.orientation == 0)
{
parent.$('#flip_to_landscape_msg').show();
parent.$('#flip_to_landscape_msg').effect("pulsate", { times:200 }, 2000);
}
else
{
parent.$('#flip_to_landscape_msg').stop(true, true);
parent.$('#flip_to_landscape_msg').hide();
}
}
setTimeout('start_orientation_detect_timer()','2000');
}
function ut()
{
canvas=document.getElementById("drawing_canvas");
context = canvas.getContext("2d");
//console.log(Math.floor(parent.$(parent.top_origin.frame_array['sig_block_frame']).width())+' '+Math.floor(canvas.width)+' '+Math.floor(parent.$(parent.top_origin.frame_array['sig_block_frame']).height())+' '+Math.floor(canvas.height));
canvas.width = parent.$(parent.top_origin.frame_array['sig_block_frame']).width();
document.getElementById('saved_layer').style.width = canvas.width;
canvas.height = parent.$(parent.top_origin.frame_array['sig_block_frame']).height();
document.getElementById('saved_layer').style.height = canvas.height;
myStage = new Kinetic.Stage(canvas);
canvas.onmousemove = function()
{
var mousePos = myStage.getMousePos();
var mouseDown = myStage.getMouseDown();
if (mousePos!=null && mouseDown)
{
draw_b(mousePos.x, mousePos.y);
}
else
{
new_segment = true;
}
};
canvas.ontouchstart = function()
{
BlockMove(event);
}
canvas.ontouchmove = function()
{
var mousePos = myStage.getMousePos();
console.log(mousePos);
if (mousePos!=null)
{
draw_b(mousePos.x, mousePos.y);
}
};
canvas.ontouchend = function()
{
new_segment = true;
};
myStage.listen();
}
function BlockMove(event)
{
// Tell Safari not to move the window.
event.preventDefault() ;
}
I know some of this isn't the most updated code, but it does work except for on Chrome mobile. I've gotten it to the point where if I do not call the start_orientation_detect_timer then the canvas is only about 100px wide by 210 tall, but I can draw on it in Chrome mobile. It seems that once the canvas is stretched, I can't draw anymore. Not even a larger canvas with bigger strokes, nothing happens and the touchstart isn't triggered.
I am creating an application using HTML5 where I would like to be able to drag a local text file into a textarea. This works fine in Firefox 20.0.1, Chrome 26.0.1410.64 m and Internet Explorer 10 but not in Opera 12.15 or Safari 5.1.7. Instead of the text of the file appearing within the text area a new page opens containing the text. I understand from this answer that I should expect problems from Safari however the implication is that it should work with Opera 12.
Any help explaining or overcoming the problem would be appreciated.
The application, which is nowhere near finished, is at grideasy.github.io with the source files at https://github.com/grideasy/grideasy.github.io
To see the effect click on the 'Content' button and drag a text file into the text area.
Both Safari and Opera pass the detect feature code below
if(window.File && window.FileReader && window.FileList && window.Blob) {
dropZone = $('drop_zone');
dropZone.value="";
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);
dropZone.addEventListener('click', storeCursorPosition, false);
dropZone.addEventListener('keyup', storeCursorPosition, false);
}
else {
}
this is found in lines 30 to 41 of the event.js file
The following code from dropcontent.js reads the file and displays the text from the file.
function handleDragOver(evt) {
evt.stopPropagation();
evt.preventDefault();
}
function handleBodyDrop(evt) {
evt.stopPropagation();
evt.preventDefault();
}
function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
var files = evt.dataTransfer.files; // FileList object.
var f = files[0];
if (f)
{
var r = new FileReader();
r.onloadend = function(e) {extract(e.target.result) }
r.readAsText(f);
}
else
{
alert("Failed to load file");
}
}
function extract(a) {
$('drop_zone').value=a;
}
Thank you for any suggestions
It appears that Opera will not accept a textarea as an object that can be used as a dropzone. Changing the textarea to a paragraph, span or div will allow that area to accept a draged and dropped file.
I'm trying to make a menu with sound after user clicks it. It works well in Chrome, safari, and even IE, but not Mozilla Firefox. I use mp3 file for the sound which can't run on firefox. Here's the code
function loadSound (src) {
var sound = document.createElement("audio");
if ("src" in sound) {
sound.autoPlay = false;
}
else {
sound = document.createElement("bgsound");
sound.volume = -10000;
sound.play = function () {
this.src = src;
this.volume = 0;
}
}
sound.src = src;
document.body.appendChild(sound);
return sound;
}
$(document).ready(function () {
var sound = loadSound("<?=base_url()?>sound/testing.mp3"); // preload
$(".main_nav a").click(function(){
var ids = $(this).attr("id").split("-");
var url = ids[2];
sound.play();
setTimeout (function(){window.location = url;}, 2000);
return false;
});
});
What type of audio file works in firefox? How do I change the source file when a user use firefox?
Ok, I understand your problem and I have a solution.
You could use this function that I make:
function getSupportedAudio(){
var testEl = document.createElement( "audio" ), mp3, ogg;
if ( testEl.canPlayType ) {
mp3 = "" !== testEl.canPlayType( 'audio/mpeg;' );
ogg = "" !== testEl.canPlayType( 'audio/ogg' );
}
if(mp3){
return ".mp3";
}
else{
return ".ogg";
}
}
In your function loadSound(src) use this:
sound.src = src+getSupportedAudio();
document.body.appendChild(sound);
And when you call the loadSound function, don't send the audio format in the parameter (but you need to have both files, ogg and mp3, in the same folder and with the same name):
var sound = loadSound("<?=base_url()?>sound/testing"); // preload