Browser displaying nothing

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Locked
User avatar
stu
Posts: 322
Joined: Wed Aug 07, 2013 11:37 am

Browser displaying nothing

Post by stu »

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=xhtml]<!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>[/syntax]

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Browser displaying nothing

Post by Gaev »

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
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Re: Browser displaying nothing

Post by dec »

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
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Browser displaying nothing

Post by Gaev »

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
dec
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain
Contact:

Re: Browser displaying nothing

Post by dec »

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
stu
Posts: 322
Joined: Wed Aug 07, 2013 11:37 am

Re: Browser displaying nothing

Post by stu »

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
fkapnist
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece
Contact:

Re: Browser displaying nothing

Post by fkapnist »

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

http://neosoftware.com/community/viewto ... 24&t=20804

:arrow:
Locked