Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    Compatibilità javascript linux windows

    Salve a tutti.
    Premetto la mia ignoranza in materia, avrei bisogno di un consiglio.
    C'è una webapp mista di javascript e flash che funziona perfettamente in locale su sistema windows, mentre eseguita su sistema linux, i comandi non interagiscono.
    Eseguo index.html, firefox apre la pagina con l'interfaccia da cui seleziono un capitolo da un menù a tendi, ma quando clicco sul tasto che mi dovrebbe mandare al capitolo scelto, non succede nulla.
    L'app utilizza swfobject 1.5.
    Qualcuno mi potrebbe dire quali funzioni di js potrebbere generare questa incompatibilità, per provare a fare un po' i debug?

  2. #2
    nessuno? Avete bisogno di più informazioni? Mi andrebbe ben anche qualche link che mi possa indirizzare a capire se il problema sia in js o in flash.

  3. #3
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    inizia col controllare i percorsi dei file esterni: su windows i percorsi sono case-insensitive mentre su altre piattaforme sono case-sensitive
    in genere questo e' il motivo della maggioranza delle presunte incompatibilita' tra piattaforme

  4. #4
    Innanzitutto grazie dell'interessamento.
    Ho controllato, ma sia i path all'interno dei file che quelli sul filesystem sono tutti in minuscolo.
    Ho notato una cosa: in un file xml richiamato come primo parametro della new di creazione di un SWFObject, vi è un carattere di cui firefox fallisce la codifica (è una c di copyright), ma anche eliminandolo il comportamento non cambia, potrebbe c'entrare? (ritengo di no, in quanto credo sia poco importante essendo all'interno di un blocco <content-text>, ma comunque...)
    Per capire per bene dove sia il problema, potrei utilizzare la console web di firefox? Pensi mi consentirebbe di fornire informazioni più utili?

  5. #5
    Scusate per questo secondo up. Prometto che non ce ne saranno altri.

  6. #6
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    e' molto difficile consigliarti qualcosa senza vedere nulla e ci sono troppe variabili in gioco per indirizzarti in una precisa direzione
    firebug puo' aiutarti ma fino ad un certo punto
    il consiglio e' di semplificare al massimo il tutto e vedere dove si blocca
    ciao

  7. #7
    capisco...purtroppo la mia ignoranza totale del javascript e di flash mi rende difficile anche essere più preciso.
    Questo è index.html
    codice:
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <title>Exploration Index</title>
    
    <script type="text/javascript" src="js/index.js"></script>
    
    <script type="text/javascript" src="js/swfobject.js"></script>
    
    <style type="text/css">
    
    	/* hide from ie on mac \*/
    
    	html {
    
    		height: 100%;
    
    		overflow: hidden;
    
    	}
    
    	
    
    	#flashcontent {
    
    		text-align: center;
    
            margin-top: 100px;
    
    	}
    
    	/* end hide */
    
    
    
    	body {
    
    		height: 100%;
    
    		padding: 0;
    
    		margin-left: 0px;
    
    		margin-top: 0px;
    
    		margin-right: 0px;
    
    		margin-bottom: 0px;
    
    	}
    
    
    
    
    
    </style>
    
    </head>
    
    <body bgcolor="#ffffff">
    
    <div id="flashcontent">
    
    <script type="text/javascript">
    
    // <![CDATA[
    
    var so = new SWFObject("index.swf?indextext=courses/en0600000000/launch.text.xml", "index", "800", "450", "8", "#FFFFFF");
    
    so.write("flashcontent");
    
    // ]]>
    
    </script>
    
    </div>
    
    </body>
    
    </html>
    e poi ci sono i due script che vengono chiamati in causa, index.js

    codice:
        function launch(c1,c2,chapter) {
    
            var ref = "theme/cheetah.html";
    
            var w = screen.width;
    
            var h = screen.height;
    
            //var c1 = "c1lang=en&c1id=en0900000000";
    
            //var c2 = "c2lang=&c2id=";
    
            //var chapter = "chapter=1";
    
            if (c1 == "blank") {
    
                alert("You must select a main course.");
    
            } else {
    
                var mywin = window.open(ref+"?"+c1+"&"+c2+"&"+chapter, "newwin", "status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,width="+w+",height="+h);
    
                mywin.moveTo(0,0);
    
            }
    
        }
    ed il secondo per l'embedding del contenuto flash è una vecchia versione (1.5) della classica libreria swfobject.
    Grazie comunque della disponibilità

  8. #8
    mi rendo conto che forse il doversi andare a cercare il sorgente di una versione di una libreria vecchia di 4 anni, può scoraggiare molti... Quindi vi posto l'swfobject.js usato nell'app in oggetto. Scusate per la lunghezza, ma su questa board non trovo alcuna formattazione che fornisca uno scroll verticale
    codice:
    /**
     * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
     *
     * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
     * http://www.opensource.org/licenses/mit-license.php
     *
     */
    if(typeof deconcept == "undefined") var deconcept = new Object();
    if(typeof deconcept.util == "undefined") deconcept.util = new Object();
    if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
    deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
    	if (!document.getElementById) { return; }
    	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
    	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    	this.params = new Object();
    	this.variables = new Object();
    	this.attributes = new Array();
    	if(swf) { this.setAttribute('swf', swf); }
    	if(id) { this.setAttribute('id', id); }
    	if(w) { this.setAttribute('width', w); }
    	if(h) { this.setAttribute('height', h); }
    	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
    	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
    	if (!window.opera && document.all && this.installedVer.major > 7) {
    		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
    		deconcept.SWFObject.doPrepUnload = true;
    	}
    	if(c) { this.addParam('bgcolor', c); }
    	var q = quality ? quality : 'high';
    	this.addParam('quality', q);
    	this.setAttribute('useExpressInstall', false);
    	this.setAttribute('doExpressInstall', false);
    	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
    	this.setAttribute('xiRedirectUrl', xir);
    	this.setAttribute('redirectUrl', '');
    	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
    }
    deconcept.SWFObject.prototype = {
    	useExpressInstall: function(path) {
    		this.xiSWFPath = !path ? "expressinstall.swf" : path;
    		this.setAttribute('useExpressInstall', true);
    	},
    	setAttribute: function(name, value){
    		this.attributes[name] = value;
    	},
    	getAttribute: function(name){
    		return this.attributes[name];
    	},
    	addParam: function(name, value){
    		this.params[name] = value;
    	},
    	getParams: function(){
    		return this.params;
    	},
    	addVariable: function(name, value){
    		this.variables[name] = value;
    	},
    	getVariable: function(name){
    		return this.variables[name];
    	},
    	getVariables: function(){
    		return this.variables;
    	},
    	getVariablePairs: function(){
    		var variablePairs = new Array();
    		var key;
    		var variables = this.getVariables();
    		for(key in variables){
    			variablePairs[variablePairs.length] = key +"="+ variables[key];
    		}
    		return variablePairs;
    	},
    	getSWFHTML: function() {
    		var swfNode = "";
    		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
    			if (this.getAttribute("doExpressInstall")) {
    				this.addVariable("MMplayerType", "PlugIn");
    				this.setAttribute('swf', this.xiSWFPath);
    			}
    			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
    			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
    			var params = this.getParams();
    			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
    			var pairs = this.getVariablePairs().join("&");
    			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
    			swfNode += '/>';
    		} else { // PC IE
    			if (this.getAttribute("doExpressInstall")) {
    				this.addVariable("MMplayerType", "ActiveX");
    				this.setAttribute('swf', this.xiSWFPath);
    			}
    			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
    			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
    			var params = this.getParams();
    			for(var key in params) {
    			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
    			}
    			var pairs = this.getVariablePairs().join("&");
    			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
    			swfNode += "</object>";
    		}
    		return swfNode;
    	},
    	write: function(elementId){
    		if(this.getAttribute('useExpressInstall')) {
    			// check to see if we need to do an express install
    			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
    			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
    				this.setAttribute('doExpressInstall', true);
    				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
    				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    				this.addVariable("MMdoctitle", document.title);
    			}
    		}
    		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
    			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
    			n.innerHTML = this.getSWFHTML();
    			return true;
    		}else{
    			if(this.getAttribute('redirectUrl') != "") {
    				document.location.replace(this.getAttribute('redirectUrl'));
    			}
    		}
    		return false;
    	}
    }
    
    /* ---- detection functions ---- */
    deconcept.SWFObjectUtil.getPlayerVersion = function(){
    	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
    	if(navigator.plugins && navigator.mimeTypes.length){
    		var x = navigator.plugins["Shockwave Flash"];
    		if(x && x.description) {
    			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
    		}
    	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
    		var axo = 1;
    		var counter = 3;
    		while(axo) {
    			try {
    				counter++;
    				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
    //				document.write("player v: "+ counter);
    				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
    			} catch (e) {
    				axo = null;
    			}
    		}
    	} else { // Win IE (non mobile)
    		// do minor version lookup in IE, but avoid fp6 crashing issues
    		// see http://blog.deconcept.com/2006/01/11...lorer-flash-6/
    		try{
    			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
    		}catch(e){
    			try {
    				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
    				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
    				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
    			} catch(e) {
    				if (PlayerVersion.major == 6) {
    					return PlayerVersion;
    				}
    			}
    			try {
    				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
    			} catch(e) {}
    		}
    		if (axo != null) {
    			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
    		}
    	}
    	return PlayerVersion;
    }
    deconcept.PlayerVersion = function(arrVersion){
    	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
    	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
    	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
    }
    deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
    	if(this.major < fv.major) return false;
    	if(this.major > fv.major) return true;
    	if(this.minor < fv.minor) return false;
    	if(this.minor > fv.minor) return true;
    	if(this.rev < fv.rev) return false;
    	return true;
    }
    /* ---- get value of query string param ---- */
    deconcept.util = {
    	getRequestParameter: function(param) {
    		var q = document.location.search || document.location.hash;
    		if (param == null) { return q; }
    		if(q) {
    			var pairs = q.substring(1).split("&");
    			for (var i=0; i < pairs.length; i++) {
    				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
    					return pairs[i].substring((pairs[i].indexOf("=")+1));
    				}
    			}
    		}
    		return "";
    	}
    }
    /* fix for video streaming bug */
    deconcept.SWFObjectUtil.cleanupSWFs = function() {
    	var objects = document.getElementsByTagName("OBJECT");
    	for (var i = objects.length - 1; i >= 0; i--) {
    		objects[i].style.display = 'none';
    		for (var x in objects[i]) {
    			if (typeof objects[i][x] == 'function') {
    				objects[i][x] = function(){};
    			}
    		}
    	}
    }
    // fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28...-143-released/
    if (deconcept.SWFObject.doPrepUnload) {
    	if (!deconcept.unloadSet) {
    		deconcept.SWFObjectUtil.prepUnload = function() {
    			__flash_unloadHandler = function(){};
    			__flash_savedUnloadHandler = function(){};
    			window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
    		}
    		window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
    		deconcept.unloadSet = true;
    	}
    }
    /* add document.getElementById if needed (mobile IE < 5) */
    if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
    
    /* add some aliases for ease of use/backwards compatibility */
    var getQueryParamValue = deconcept.util.getRequestParameter;
    var FlashObject = deconcept.SWFObject; // for legacy support
    var SWFObject = deconcept.SWFObject;
    Tecnicamente non è un up

  9. #9
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    ma se usassi swfobject 2 avresti lo stesso problema?
    sinceramente postare il sorgente di swfobject 1.5 non credo possa aiutare molto...

    come sempre, si hanno molte piu' possibilita' di risposta mettendo gli altri utenti in condizione di testare l' applicazione, magari preparane una versione molto semplificata da scaricare/testare online

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.