An other CDATA issue

Discussion about any web related scripting languages like JavaScript, ASP, and PHP.
Post Reply
User avatar
Lou
Rank V - Professional
Rank V - Professional
Posts: 277
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

An other CDATA issue

Post by Lou » Thu Jan 06, 2011 1:20 pm

I think I have this stripped down. When I run this through the Validator (10.01) I get the following warning:
[JavaScript] lint warning: missing semicolon
for the window.onunload = function() line inside the CDATA script.

Now if I add a semicolon before that line the warning goes away. ??? any help?

My real problem is that I am trying to add Facebook "Like" buttons to a phpBB forum I an developing.
[DELETE = this is not related I fine]
These functions, from phpBB 3.0.8, cause the Facebook functions to run in an infinite loop Only in Firefox. When you click the Facebook "like" button Facebook pops up a window so you can signin to facebook. That window pops up & closes infinitely. This does not happen in other browsers - current IE, Safari, Chrome or Opera.
[/DELETE]
Knowing how the pointing finger thing can go I am trying to localize problems before I get to they "don't play well together." :?

Code: Select all

<!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" dir="ltr" lang="en-gb" xml:lang="en-gb">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<script type="text/javascript">
// <![CDATA[
	var jump_page = 'Enter the page number you wish to go to:';
	var on_page = '1';
	var per_page = '';
	var base_url = '';
	var style_cookie = 'phpBBstyle';
	var style_cookie_settings = '; path=/; domain=www2.knob.com';
	var onload_functions = new Array();
	var onunload_functions = new Array();

	/**
	* New function for handling multiple calls to window.onload and window.unload by pentapenguin
	*/

	window.onload = function()
	{
		for (var i = 0; i < onload_functions.length; i++)
		{
			eval(onload_functions[i]);
		}
	}

	window.onunload = function()
	{
		for (var i = 0; i < onunload_functions.length; i++)
		{
			eval(onunload_functions[i]);
		}
	}

// ]]>
</script>

</head>

<body>
</body>
</html>
Lou
Say what you will about Sisyphus. He always has work.

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3440
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: An other CDATA issue

Post by Albert Wiersch » Wed Jan 12, 2011 3:07 pm

Hi Lou,

I'm sorry for the delay.

I think you should add a couple of semicolons to end the assignment statements:

Code: Select all

       window.onload = function()
       {
          for (var i = 0; i < onload_functions.length; i++)
          {
             eval(onload_functions[i]);
          }
       };

       window.onunload = function()
       {
          for (var i = 0; i < onunload_functions.length; i++)
          {
             eval(onunload_functions[i]);
          }
       };
It seems that the JavaScript Lint messages weren't very good at pointing out the location of the missing semicolons, but I think it was referring to the above.
Image
Albert Wiersch

User avatar
Lou
Rank V - Professional
Rank V - Professional
Posts: 277
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: An other CDATA issue

Post by Lou » Wed Jan 12, 2011 4:46 pm

Thanks Albert.
However, I'm still in search of a fix. The facebook development/documentation/forum has not provided any additional info and seems to be full of unanswered "it doesn't work" type post. If I weren't doing this for someone else I would move on.
Lou
Say what you will about Sisyphus. He always has work.

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3440
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: An other CDATA issue

Post by Albert Wiersch » Wed Jan 12, 2011 5:23 pm

Lou wrote:Thanks Albert.
However, I'm still in search of a fix. The facebook development/documentation/forum has not provided any additional info and seems to be full of unanswered "it doesn't work" type post. If I weren't doing this for someone else I would move on.
So the real issue is the infinite loop in Firefox? I wish I could help with that but I am not familiar with Facebook scripting.

You may one to post your question in the phpBB support forums (http://www.phpbb.com/community/index.php) since it doesn't seem you're getting much help from the Facebook forums.

I hope that adding the semicolons at least took care of the JavaScript Lint issues.
Image
Albert Wiersch

User avatar
Lou
Rank V - Professional
Rank V - Professional
Posts: 277
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO
Contact:

Re: An other CDATA issue

Post by Lou » Wed Jan 12, 2011 8:23 pm

Albert Wiersch wrote:You may one to post your question in the phpBB support forums
Also frustrating results.
http://www.phpbb.com/community/viewtopi ... #p12931499
Interestingly some in an effort to help discover their implementation does not work in all browsers either.
Lou
Say what you will about Sisyphus. He always has work.

Post Reply