Webgadget not working with script created content

Just starting out? Need help? Post your questions and find answers here.
Uncle B
User
User
Posts: 82
Joined: Mon Jan 12, 2004 11:28 am
Location: the Netherlands

Webgadget not working with script created content

Post 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
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Webgadget not working with script created content

Post 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
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Webgadget not working with script created content

Post by netmaestro »

There might be something here you can use, not sure: http://forums.purebasic.com/english/vie ... 12&t=16968
BERESHEIT
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: Webgadget not working with script created content

Post by rsts »

Maybe something to help here http://www.purebasic.fr/english/viewtop ... 13&t=51964

cheers
Uncle B
User
User
Posts: 82
Joined: Mon Jan 12, 2004 11:28 am
Location: the Netherlands

Re: Webgadget not working with script created content

Post 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
Post Reply