Source language: Translate to:

Browser displaying nothing

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Browser displaying nothing

Postby stu » Tue Dec 16, 2014 8:03 am

I'been trying to display a few charts from Neobook with info from a database... Just for testing...

Library I'm playing with is: http://www.chartjs.org/

Now, if I try to load any of the samples on web browser they work fine. But if I put them on a Neobook web browser object the browser shows nothing :?:

Syntax: [ Download ] [ Hide ]
Using XHTML Syntax Highlighting
<!doctype html>
<html>
        <head>
                <title>Pie Chart</title>
                <script src="C:\Users\stu\Desktop\Chart.js-master\Chart.js"></script>
        </head>
        <body>
                <div id="canvas-holder">
                        <canvas id="chart-area" width="300" height="300"/>
                </div>


        <script>

                var pieData = [
                                {
                                        value: 3000,
                                        color:"#F7464A",
                                        highlight: "#FF5A5E",
                                        label: "Something else"
                                },
                                {
                                        value: 50,
                                        color: "#46BFBD",
                                        highlight: "#5AD3D1",
                                        label: "Green"
                                },
                                {
                                        value: 1000,
                                        color: "#FDB45C",
                                        highlight: "#FFC870",
                                        label: "Yellow"
                                },
                                {
                                        value: 40,
                                        color: "#949FB1",
                                        highlight: "#A8B3C5",
                                        label: "Grey"
                                },
                                {
                                        value: 120,
                                        color: "#4D5360",
                                        highlight: "#616774",
                                        label: "Dark Grey"
                                }

                        ];

                        window.onload = function(){
                                var ctx = document.getElementById("chart-area").getContext("2d");
                                window.myPie = new Chart(ctx).Pie(pieData);
                        };



        </script>
        </body>
</html>
Parsed in 0.007 seconds, using GeSHi 1.0.8.10


That up there is the source of one of the samples, path to the js file is been edited... just that...

Any clues >?
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Browser displaying nothing

Postby Gaev » Tue Dec 16, 2014 10:25 am

stu:

When you use NeoBook's WebBrowser object, it may be rendering according to IE v7 or v8 ... even if you have a different IE version on your computer.

See notes about Browser Support ... in particular ...
For IE8 & below, I would recommend using the polyfill ExplorerCanvas - available at https://code.google.com/p/explorercanvas/. It falls back to Internet explorer's format VML when canvas support is not available. Example use:

<head>
<!--[if lte IE 8]>
<script src="excanvas.js"></script>
<![endif]-->
</head>

... although, I recall reading elsewhere that Google has discontinued support for this.

The charts are rendered using the < canvas > tag ... IE v7 does not support this tag ... not sure about IE v8.

Also, you might try and replace this line in your HTML ...
Code: Select all
<script src="C:\Users\stu\Desktop\Chart.js-master\Chart.js"></script>
... with inline code (content of the .js file) ...
Code: Select all
<script>
... content here ...
</script>
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Browser displaying nothing

Postby dec » Tue Dec 16, 2014 11:13 am

Hello,

Taking a look, apparently this can be made using the Internet Explorer EMULATION feature, that we take in consideration before in this forum. Trying emulating the latest Internet Explorer version (11001, as you can see here) the JavaScript Chart works well if we previously add into the Windows Registry the appropiate key and value.

To do this you can use, for example, the npConf plugin, before navigate to any chart HTML document:

Code: Select all
npRegCreate "[RegID]"
npRegOpenKey "[RegID]" "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" "True" "[Result]"
npRegWriteValue "[RegID]" "a_Test.exe" "11001" "Integer" "[Result]"
npRegDestroy "[RegID]" "[Result]"

.Show our JavaScript Chart
BrowserGoTo "WebBrowser1" "C:\Users\dec\Desktop\Chart.js-master\Chart.js-master\samples\doughnut.html"


And when your publication closed, for cleaning purposes:

Code: Select all
npRegCreate "[RegID]"
npRegOpenKey "[RegID]" "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" "True" "[Result]"
npRegDeleteValue "[RegID]" "a_Test.exe" "[Result]"
npRegDestroy "[RegID]" "[Result]"


Doing something like this I can run without problems the couple of examples I tried.

Image

** Note the use of the "a_Test.exe" in the above code. This must be the name of your executable according to Windows. However, if you plain to use in design time, remember you need to append "_Test" to the name of your executable, since NeoBook use it in designtime.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Browser displaying nothing

Postby Gaev » Tue Dec 16, 2014 2:28 pm

dec:

Is it correct that you can only set/use the emulation level for a WebBrowser if that particular version (or less?) of IE is installed on the particular computer ?

In other words, even if it works on your (say) Windows 7 with IE v9 installed on it ... the same NeoBook exe will not run on another user's (say) Windows XP with IE v7.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Browser displaying nothing

Postby dec » Tue Dec 16, 2014 3:03 pm

Hello,

Gaev wrote:dec:

Is it correct that you can only set/use the emulation level for a WebBrowser if that particular version (or less?) of IE is installed on the particular computer ?

In other words, even if it works on your (say) Windows 7 with IE v9 installed on it ... the same NeoBook exe will not run on another user's (say) Windows XP with IE v7.


I am not an expert in the "Internet Feature Controls" or in particular in the "Browser emulation" modes of Internet Explorer. I simply use the same "magic number" than I use in other of my software. What I wanted with that number is to avoid the "dirty" or "compatibility" modes, in other words, always use the "edge" mode, no matter the Internet Explorer installed version. To be honest right now I am not sure if we need to add this "magic number" (for IE11) and also others numbers for possible previous Internet Explorer versions. Really I hope Windows understand I wanted the "edge" mode in whatever Internet Explorer installed version. In my own programs I only use the refered "magic number" and no others, so maybe I need to back again on this field and for this reason in particular.

On the other hand, the "Browser emulation" works in Internet Explorer 8 and later, so... But anyway I am not sure if the script itself works well in IE7, not only from a NeoBook publication, but just in the Internet Explorer browser. I can't test it because here I only play with Windows 8 and Windows 10 Technical Preview.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Browser displaying nothing

Postby stu » Tue Dec 16, 2014 5:20 pm

What a handful of sweet answers! got enough to play with!... Will be checking npConf, maybe I can use this library in the future to display charts!

Awesome!

------

Just test it, works like a charm... Thanks for the replies dudes!
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Browser displaying nothing

Postby fkapnist » Wed Dec 17, 2014 7:36 am

Here is a sample PUB that helps you find the correct IE Browser emulation ....

http://neosoftware.com/community/viewtopic.php?f=24&t=20804

:arrow:
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

cron