Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

javascript - swfobject.js won't display flash in chrome (works in edge)

I'm trying to fix this Data Analyzer script which generates flash charts, works fine in the Edge but bugs in chrome somehow by not showing the results.

(works in Chrome locally)

Can anyone please suggest me how to upgrade or fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To view your Flash content in Chrome, you have to do following steps:

1) Whilst on your page, click the green padlock icon in address bar.

2) Go to Flash settings and change from Ask (default) into Allow (for all future visits).

3) click Reload in the notification pop-up (or just refresh page).

This is because you're not directly embedding any Flash content (a .swf file) in the page, your DataAnalyzer.js is dynamically adding a div for the SWF later on with code like this:

var div = document.createElement('div');
div.id = "Chart" + count; div.className = 'chartCSS'; dest.appendChild(div);

chartType =  _ge('cmbChartType').value;
if(chartType == 'Random') { chartType = (Math.floor(Math.random()*2)) == 0 ? 'pie' : 'bar'; }

if(chartSrc == 'Flash Chart') 
{
window['myChart'+count] = new SWFObject("open-flash-chart.swf", div.id, this.chartHeight, this.chartWidth, "9", "#FFFFFF");
window['myChart'+count].addVariable("variables","true");
window['myChart'+count].addVariable('x_label_style','10,0x0000FF,2');
window['myChart'+count].addVariable("tool_tip", Charts[count].LabelX + ": #x_label#<br>" + (operation != -1 ? Charts[count].LabelY : 'Count') + ": #val#");
window['myChart'+count].addVariable((chartType == 'pie' ? 'pie' : 'bar_glass'), '50,#7E97A6');
window['myChart'+count].addVariable("title",Charts[count].Title + ',{font-size: 16px;}');

// ...etc etc...

}

This kind of dynamic embedding is also a trick used by malicious sites so it's blocked by default. If you have other end-users, then they too must do those 3 steps in their own Chrome browsers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...