An other CDATA issue

Discussion about any web related scripting languages like JavaScript, ASP, and PHP.

An other CDATA issue

Postby Lou » Thu Jan 06, 2011 2: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>
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD

Re: An other CDATA issue

Postby Albert Wiersch » Wed Jan 12, 2011 4: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
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: An other CDATA issue

Postby Lou » Wed Jan 12, 2011 5: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.
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD

Re: An other CDATA issue

Postby Albert Wiersch » Wed Jan 12, 2011 6: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
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: An other CDATA issue

Postby Lou » Wed Jan 12, 2011 9: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/viewtopic.php?f=70&t=2093379&start=120#p12931499
Interestingly some in an effort to help discover their implementation does not work in all browsers either.
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD


Return to Scripting Languages

Who is online

Users browsing this forum: No registered users and 1 guest

cron