Source language: Translate to:

Why does the NB Browser suddenly stop showing Javascript

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Fri Oct 18, 2013 9:25 am

I have a javascript that runs Google Charts from data in NB, and while I am testing the script out (with errors etc) it seems to display the chart just fine in the NB
Browser as a string source. (except when my code is bad of course). But then at some point it stops showing the script part of chart as you can see in the image below
on the right side where I drew a black box. The code still runs fine in a regular browser using the internetlink action as you can see on the left.

My question is, does anyone know what the NB browser would suddenly stop displaying. It can't be the code. It does show the HTML portion at the top
but not the javascript chart.

Is it a security issue? I've checked and unchecked every button in the NB browser object.

Help!

Don








Image
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Re: Why does the NB Browser suddenly stop showing Javascript

Postby Gaev » Fri Oct 18, 2013 10:08 am

Don:
as you can see in the image below on the right side where I drew a black box.
Where ? ... I don't see no black box.
does anyone know what the NB browser would suddenly stop displaying. It can't be the code. It does show the HTML portion at the top but not the javascript chart
Are you populating the Web Browser object with the BrowserGoTo command or the BrowserloadFromStr command ?

In either case, post the (HTML+Javascript) code that is being loaded.
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Fri Oct 18, 2013 10:46 am

Well the image cut it off a bit, you can see it on the right side. I just drew it in, the chart would have shown there.

Here is the code:

Code: Select all
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
['TaskOwner', 'Number of Task', 'Ready to Work', 'PR>1'],
['Donald Walker', 34, 20, 5],
['Bob Helper', 3, 3, 1],
['Will Rogers', 3, 3, 3],
['Tom Argo', 2, 2, 1],
['Erin ORylee', 1, 0, 0],
        ]);

        var options = {
          title: 'Project Performance by Task Owner',
          hAxis: {title: 'Task Owners', titleTextStyle: {color: 'red'}}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
  <h2>  Friday, October 18, 2013</h2>
  <h4> Project:   Baylor University Football Stadium</h4>
  <h4> Reporter:   Will Rogers</h4>
  <Br>
<A HREF="http://projectglimpse.com">See Full Report Here</A>
    <!--Div that will hold the Col chart-->
    <div id="chart_div" style="width: 600px; height: 500px;"></div>
  </body>
</html>
  </body>
</html>

Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Re: Why does the NB Browser suddenly stop showing Javascript

Postby Neosoft Support » Sat Oct 19, 2013 10:54 am

Are you using BrowserLoadFromStr to populate the browser? If so you will need to replace the [ and ] characters with [#91] and [#93]. Otherwise, NeoBook will try to interpret them as variables and screw up the html code before it reaches the browser.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Sat Oct 19, 2013 11:22 am

Well I'll be a son of gun. That makes sense.

I use this code to create the sting that is then replaced in the javascript template. It creates the brackets using the [#91] etc.
I do the loop because I have changing amounts of data in different charts.

Now I need to create the string using the ascii code. Not sure I know how to do that. I put a ! in front of the ![#91] but that didn't do it.

Code: Select all
Loop "1" "[numberslicesx]" "[now]"
Filewrite "[pubdir]items2.txt" "Append" "[#91][#39]##C1[now]##[#39], ##C2[now]##, ##C3[now]##, ##D4[now]##[#93],"
Endloop


I guess I will have to do a second replacement outside of NB unless someone knows how to do that.
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Re: Why does the NB Browser suddenly stop showing Javascript

Postby Neosoft Support » Sat Oct 19, 2013 11:42 am

I'm not sure exactly what you mean, but here is your original code with the square brackets replaced:

Code: Select all
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:[#91]"corechart"[#93]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([#91]
[#91]'TaskOwner', 'Number of Task', 'Ready to Work', 'PR>1'[#93],
[#91]'Donald Walker', 34, 20, 5[#93],
[#91]'Bob Helper', 3, 3, 1[#93],
[#91]'Will Rogers', 3, 3, 3[#93],
[#91]'Tom Argo', 2, 2, 1[#93],
[#91]'Erin ORylee', 1, 0, 0[#93],
        [#93]);

        var options = {
          title: 'Project Performance by Task Owner',
          hAxis: {title: 'Task Owners', titleTextStyle: {color: 'red'}}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
  <h2>  Friday, October 18, 2013</h2>
  <h4> Project:   Baylor University Football Stadium</h4>
  <h4> Reporter:   Will Rogers</h4>
  <Br>
<A HREF="http://projectglimpse.com">See Full Report Here</A>
    <!--Div that will hold the Col chart-->
    <div id="chart_div" style="width: 600px; height: 500px;"></div>
  </body>
</html>
  </body>
</html>
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Sat Oct 19, 2013 12:04 pm

Did you get this to run in your NB browser? It does not run in mine. What about the double quotes, does that need to be ascii'd out also?
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Re: Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Sat Oct 19, 2013 12:46 pm

I finally figured it out. Has nothing to do with brackets etc.

This is the right code snippet:

Code: Select all
['TaskOwner', 'Number of Task', 'Ready to Work', 'PR>1'],
['Donald Walker', 34, 20, 5],
['Bob Helper', 3, 3, 1],
['Will Rogers', 3, 3, 3],
['Tom Argo', 2, 2, 1],
['Erin ORylee', 1, 0, 0]
        ]);


This is the wrong code snippet:

Code: Select all
['TaskOwner', 'Number of Task', 'Ready to Work', 'PR>1'],
['Donald Walker', 34, 20, 5],
['Bob Helper', 3, 3, 1],
['Will Rogers', 3, 3, 3],
['Tom Argo', 2, 2, 1],
['Erin ORylee', 1, 0, 0],
        ]);


Do you see the little comma at the far right of the Erin ORylee line, after the 0] on the right. That is the problem.

What is so odd about it is that it will display with the comma is any browser except the NB browser. Or at least the ones I have.

So to solve this,I need to make sure when I create my loop, which puts a comma at the end of each line, that I go back and remove it from the last line.

Sorry to have wasted yall's time on this but it had me baffled. :roll:
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Re: Why does the NB Browser suddenly stop showing Javascript

Postby Neosoft Support » Mon Oct 21, 2013 11:01 am

What is so odd about it is that it will display with the comma is any browser except the NB browser. Or at least the ones I have.


Who knows. Usually when JavaScript code contains a type it won't work at all. It could be that some browsers will ignore certain typos. (NB's browser is actually Internet Explorer.)

Anyway, glad you figured it out.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: Why does the NB Browser suddenly stop showing Javascript

Postby datadon » Mon Oct 21, 2013 11:08 am

I understand. Actually all is working fantastic right now. This is a great way to generate charts, at least until Google changes something on me. There are other options for this other than Google, but theirs is working pretty well right now for a javascript illiterate like me.
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest