FusionCharts Forum: Charts not displaying in .xhtml pages in Safari - FusionCharts Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Charts not displaying in .xhtml pages in Safari

#1 User is offline   nvfellers 

  • Forum Newbie
  • Group: Members
  • Posts: 2
  • Joined: 30-July 10

Posted 30 July 2010 - 01:54 PM

If your web pages have a .xhtml extension, following strict HTML 4.01 compliance, then they stop working in browsers that adhere to strict standards (e.g., Safari), when run on an application server. For my situation, the reason the pages have .xhtml extensions is that I am using JavaServer Faces (JSF) with Facelets. Separately, I believe mobile phones and other small devices also render xhtml, but I may be mistaken.



To solve the problem, I modified fusioncharts.js by revising the the render and getSWFHTML functions:


	render: function(elementId){

                       else {

				//Normal case. Instantly load the chart

				if (navigator.appName.indexOf("Microsoft Internet") != -1) {

					n.innerHTML = this.getSWFHTML();

				}else  {

					var embed = document.createElement('embed');

					this.getSWFHTML(embed);

					n.appendChild(embed);

				}

			}

	}

	getSWFHTML: function(node) {

		var swfNode = "";

		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { 

			// netscape plugin architecture			

			node.setAttribute('type', 'application/x-shockwave-flash');

			node.setAttribute('src', this.getAttribute('swf'));

			node.setAttribute('width',  this.getAttribute('width'));				

			node.setAttribute('height', this.getAttribute('height'));

			node.setAttribute('id', this.getAttribute('id'));

			node.setAttribute('name', this.getAttribute('id'));

			

			var pairs = this.getVariablePairs().join("&");

			var params = this.getParams();

			for(var key in params) { 

				params[key].replace(/&/g, "&").replace(//g, ">");

				node.setAttribute([key], params[key]); 

			}

			

			if (pairs.length > 0){

				pairs.replace(/&/g, "&").replace(//g, ">");

				node.setAttribute('flashvars', pairs); 

			}

              }else



Vance
0

Other Replies To This Topic

#2 User is offline   nvfellers 

  • Forum Newbie
  • Group: Members
  • Posts: 2
  • Joined: 30-July 10

Posted 31 July 2010 - 11:36 AM

The root of this problem, when using xhtml, is that the rendered embed tag is not closed, thus not standards compliant. This fact does not bother IE or Firefox, which I assume are rendering in quirks mode; however, browsers like Safari and probably Chrome will not display the embedded charts.



The top of my pages look as follows:


!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

html xmlns="http://www.w3.org/1999/xhtml"

                  xmlns:ui="http://java.sun.com/jsf/facelets"

	          xmlns:f="http://java.sun.com/jsf/core" 

                  xmlns:h="http://java.sun.com/jsf/html" >





I had to remove the leading < on doctype and html, or they would not display in this forum page.



Vance
0

Other Replies To This Topic

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic