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

主宰稳场 提交于 2019-12-13 11:01:45

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/46881757/swfobject-js-wont-display-flash-in-chrome-works-in-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!