Flash and Jquery
Flash and Jquery
Hello,
I'm developing a script for reading the HTML content of a page and pass it as a variable to a Flash movie.
In most browser this works fine but in IE the user needs to refresh the page. Here is the code I'm using:
-
$(document).ready(function(){
var browser =navigator.userAgent
//detect if I should display Flash or not
var isFlash = (browser.match(/iPhone/i)) || (browser.match(/iPod/i) || browser.match(/Internet/));
if(imagefolder!=null && !isFlash) {
//substitute all the ampersands from the text with variable friendly code
var textToPass = $("#content").html().replace(/&/, "%26");
//Interet Explorer will remove the quotes from the tag properties (i.e <p class=test> note the lack of double quotes after 'class').
//Use this to add them back again
if(!jQuery.support.htmlSerialize) {
var array = textToPass.split(/class=/);
var final= array[0];
for (var i = 1; i < array.length; i++){
final+=(addQuotes(array[i])); //add quotes and concatanate to one string
};
function addQuotes(s) {
var r;
var a = s.search(/>/);
var t ="class='"+s.substr(0,a)+"'"; //this method works only if the tag has one property
return t + s.substr(a);
}
textToPass=final;
}
var flashvars = {folder: imagefolder, text: textToPass};
var params = {wmode: 'transparent'};
swfobject.embedSWF("gallery.swf?r="+ new Date().getTime(), "content", "825", "690", "9.0.0", "js/expressInstall.swf",flashvars,params);
}
and
www.stirlingandson.co.uk/new
is the website I'm working on
Any thoughts?
Thank you!
Thanks