Page 1 of 1

Webgadget not working with script created content

Posted: Sun Dec 15, 2013 9:28 pm
by Uncle B
Hello all,

I'm experiencing a strange problem with the PB webgadget under Windows 8.
The problem is that it doesn't seem to show elements that were created by the JavaScript createElement() method.
The below HTML file will load perfectly in both IE11 and Google Chrome, but will not load correctly in the web gadget.

Test123.htm:

Code: Select all

<!DOCTYPE html><html><head>
<style type="text/css">
.tst{
position:absolute;
top: 100px;
left: 100px;
width: 500px;
height: 500px;
border:1px solid grey;
overflow:auto;
}
</style>
</head>
<body>
<div id="test" class="tst"></div>
</body>

<script type="text/javascript">
function TestFunc(){
	var dv = document.getElementById("test");
	var tbl = document.createElement("table");
	dv.appendChild(tbl);

	for(i=0;i<20;i++){
		var rw = document.createElement("row");
		tbl.appendChild(rw);

		for(j=0;j<100;j++){
			var td = document.createElement("td");
			rw.appendChild(td);
			var txt = document.createTextNode("Test" + j);
			td.appendChild(txt);		
			}
		}
}
TestFunc();
</script>
</html>
PB code webgadget:

Code: Select all

If OpenWindow(0, 10,10, 500,500, "Test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  
  WebGadget(1, 0,20,500,480, "")
  ButtonGadget(2, 0, 0, 150, 20, "Open")
  ButtonGadget(3, 150, 0, 150, 20, "Refresh")
  
  Repeat
    
    ev = WaitWindowEvent()  
    Select ev
        
      Case #PB_Event_CloseWindow
        Break
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
          Case 2  
            fle.s = OpenFileRequester("Open file:", GetCurrentDirectory() + "\Test123.htm",  "HTML files (*.htm)|*.htm", 0)
          
            If fle <> ""
              SetGadgetText(1, fle)
            EndIf

        Case 3
          SetGadgetState(1, #PB_Web_Refresh)
   
        EndSelect  
    EndSelect    
  ForEver
EndIf
The test123.htm file will show a fixed size 'div' element with a large table inside in regular browsers, but the PB webgadget will only show an empty 'div' element.
Is there anyone who knows where to look for a solution? The available documentation on the webgadget is not very extensive. Also I am surprised to find a difference between the webgadget and IE as they seem to be very much the same thing according the available documentation.

Anyway, advanced thanks for anyone to reply.
Best regards,

Bart

Re: Webgadget not working with script created content

Posted: Mon Dec 16, 2013 12:04 am
by rsts
If I remember correctly, the "out-of-the-box" webgadget is not up to current IE standards, unless you're talking something like ie5 or thereabouts.

There are some changes you can make either via a command or a registry setting to force the webgadget to use the current IE engine. I've never done it, but it is mentioned in the forums.

It's possible RASHAD has supplied a solution.

Try a search. I will continue to search also.

cheers

Re: Webgadget not working with script created content

Posted: Mon Dec 16, 2013 3:36 am
by netmaestro
There might be something here you can use, not sure: http://forums.purebasic.com/english/vie ... 12&t=16968

Re: Webgadget not working with script created content

Posted: Mon Dec 16, 2013 4:18 am
by rsts
Maybe something to help here http://www.purebasic.fr/english/viewtop ... 13&t=51964

cheers

Re: Webgadget not working with script created content

Posted: Mon Dec 16, 2013 9:36 pm
by Uncle B
Thanks both!
The last one did the trick, I gratefully copied and pasted TI-994A's code to change the browser emulation register key to IEv9.
I thought this would take more effort. :D :D :D