NetTalk Central

Author Topic: Error in Site Javascript + Webinar 217  (Read 4903 times)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Error in Site Javascript + Webinar 217
« on: July 07, 2013, 02:39:13 PM »
Hi Bruce: Just watched the webinar.  Great job, per usual.

One thing that got lost in the shuffle was your explanation of using Firebug to track down the pesky Error in Javascript.  If it's not too much trouble, maybe a quick run-down when you have time.

Thanks,

Jim

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #1 on: July 07, 2013, 03:26:27 PM »
Hello Jim,

Open Firebug. 

Click on the "Console" tab.

Just below the Console tab you will See:  All  Errors  Warnings  Info  Debug Info  Cookies

Load the page with the Javascript Error.

Look under Errors and you will see where you are having problems.

Good luck,

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #2 on: July 07, 2013, 03:41:29 PM »
Thanks Don.  Mission accomplished.  Now I need to figure out what it means.

jQuery(...).page is not a function

Line 420

Offending code is highlighted below:

    if (s){
            s = s.substring(s.indexOf('>')+1,s.lastIndexOf('<'));
            if (e=='element'){
                d = jQuery(t).attr("id");
                jQuery("#"+d).replaceWith(s);
                try{jQuery("#"+d).page().removeClass("ui-page").css('border',0);} catch(e){};            } else if (e=='script'){
                s = s.replace(/&quot;/g,'"');
                s = s.replace(/&amp;/g,"&");
                s = s.replace(/&lt;/g,"<");
                s = s.replace(/&gt;/g,">");
                try{
                eval(s);
                } catch (e){
                    try{
                    } catch (e){}
                }
            }
        }

Maybe I'll try commenting it out.


Appreciate the help.

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #3 on: July 07, 2013, 05:26:24 PM »
No custom scripts.  I do have embedded code in the app procedures. The code is mainly SSV and GSV  -- plus the usual login code. This worked fine in 7.12.  

Deleted the Web Folder.

I've looked through the Version History but can't seem to find anything.  If it helps, I've attached a small png that shows the errors that Firebug kicks out.  

BTW: I get same behavior from Web71.app)

[attachment deleted by admin]
« Last Edit: July 07, 2013, 05:49:32 PM by Jim A »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11245
    • View Profile
Re: Error in Site Javascript + Webinar 217
« Reply #4 on: July 09, 2013, 02:08:37 AM »
[ note : I removed some messages from this thread, because the forum doesn't like long threads, and because while useful suggestions they were going down a dead end.]

>> If it helps, I've attached a small png that shows the errors that Firebug kicks out.

what you showed were warnings, not errors. Warnings are fairly common (usually complaining about browser-specific stuff, as these were) and can be turned off in Firebug.

Back to your original problem though - this is one of those cases where firebug is not as clever as it could be. On the up side we are not limited to firebug, so there are other approaches to this.

the error you got is quite "common" but what it's really complaining about is the line eval(s); - and specifically it's complaining that some script that was passed back to the browser has stopped while executing.
In this situation I usually run in Chrome browser, F12 for developer tools, and then look at the console there. It often points to a different point on the page, or in the code.

If all else fails either send me an example, or put it online where I can access the effect from here.

Cheers
Bruce

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #5 on: July 09, 2013, 03:11:01 AM »
Thanks Bruce.

It appears (from Chrome) that my method for displaying photos from a non-web folder is generating the error. I use the process proposed here by Bill Shields:  http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=3793.0

The code works fine, just started flashing the red Javascript warning.  Hoping to make that go away..

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11245
    • View Profile
Re: Error in Site Javascript + Webinar 217
« Reply #6 on: July 09, 2013, 03:27:45 AM »
I gues you'll need to post an example Jim - it's hard to debug customized embed code without seeing it.

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #7 on: July 09, 2013, 03:30:07 AM »
Thanks Bruce.  I will throw something together that can be posted here.  Meanwhile, have sent you private mail.

malcolmg

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • Email
Re: Error in Site Javascript + Webinar 217
« Reply #8 on: July 09, 2013, 12:58:17 PM »
Not sure if its related but I have just gone through the same pain with ""jQuery(...).page is not a function" line 312 in my case. 

Turned out to be related to a database issue.  I had imported PostgreSQL tables and the date overlay is not happy.  As I dont need the time portion I converted to Date format and all working again.

HTH

Malcolm