Page 1 of 1

Loading *.xhtml in WebGadget

Posted: Sat Dec 29, 2012 5:31 pm
by Perkin
How can I load a xhtml file into a WebGadget?

If I try using SetGadgetText(#Web1,filename) then the Download-Open/Save Dialog pops up.

If using a *.htm or *.html then it woks fine, just have problem with *.xhtml

Workaround at moment is to temporarily rename the file, load it, then rename it back again.

But that will not work for final use as will probably be used for Read-Only files.

Code: Select all

If OpenWindow(1, 0, 0, 800, 600, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
	
	ButtonGadget(0,4,4,60,24,"Open")
	WebGadget(1, 0,30, 800, 800,"")
	
	Repeat
		event = WaitWindowEvent()
		Select event
			Case #PB_Event_Gadget
				Select EventGadget()
					Case 0
						zfile.s=OpenFileRequester("Open File...","","Any|*.html;*.htm;*.xhtml*",0)
							SetGadgetText(1,zfile)
						EndIf
				EndSelect
		EndSelect
	Until event = #PB_Event_CloseWindow
EndIf

Re: Loading *.xhtml in WebGadget

Posted: Wed Jan 16, 2013 5:19 pm
by Seymour Clufley
In this day and age, I don't think there is any need for XHTML. Everything can be done with standardised HTML5.

Re: Loading *.xhtml in WebGadget

Posted: Wed Jan 23, 2013 9:13 pm
by Perkin
Seymour Clufley wrote:In this day and age, I don't think there is any need for XHTML. Everything can be done with standardised HTML5.
I'm not creating the files, just viewing them and would like them in the WebGadget.

That's the problem, when I try the Open/Save dialog comes up, and if you open - main browser opens with the file.

Re: Loading *.xhtml in WebGadget

Posted: Wed Jan 23, 2013 9:25 pm
by Kiffi
@Perkin: I cannot reproduce your problem. Do you have a xhtml-file for me?

Greetings ... Kiffi

Re: Loading *.xhtml in WebGadget

Posted: Thu Jan 24, 2013 3:25 pm
by Perkin
Kiffi wrote:@Perkin: I cannot reproduce your problem. Do you have a xhtml-file for me?

Greetings ... Kiffi
Save this as test.xhtml (All upto < body > is from real file needed, the body is just Lorem text to fill the page, but still shows the same problem)

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Unknown</title>
</head>

<body>
<h1>Prologue</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Nulla ac tellus nunc.</p>
<p>Phasellus imperdiet leo metus, et gravida lacus.</p>
<p>Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc.</p>
<p>Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula.</p>
<p>Praesent orci dui, pulvinar id convallis a, faucibus non mauris.</p>
<p>Donec tellus augue, tempus sed facilisis sed, fringilla quis leo.</p>
<p>Mauris vulputate, leo ac facilisis vulputate, enim orci interdum augue, in blandit quam turpis quis dui.</p>
<p>Morbi dictum luctus velit nec faucibus.</p>
<p>Cras vitae tortor purus, ut tincidunt mauris.</p>
<p>Sed at velit nisl.</p>
<p>Donec eu mauris tortor, interdum condimentum erat.</p>
<p>Nam egestas turpis eget nibh laoreet pharetra.</p>
<p>Suspendisse a sem eros, ut pulvinar enim.</p>
<p>In sed elit eu nulla accumsan tincidunt eget sit amet ipsum.</p>
<p>Nullam ut massa rutrum dolor placerat tempor accumsan eget purus.</p>
</body>
</html>
Then try and open it with this, (fixed missing 'if zfile' from first post' code)

Code: Select all

If OpenWindow(1, 0, 0, 800, 600, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
	
	ButtonGadget(0,4,4,60,24,"Open")
	WebGadget(1, 0,30, 800, 570,"")
	
	Repeat
		event = WaitWindowEvent()
		Select event
			Case #PB_Event_Gadget
				Select EventGadget()
					Case 0
						zfile.s=OpenFileRequester("Open File...","","Any|*.html;*.htm;*.xhtml*",0)
						If zfile
 							SetGadgetText(1,zfile)
						EndIf
				EndSelect
		EndSelect
	Until event = #PB_Event_CloseWindow
EndIf

Re: Loading *.xhtml in WebGadget

Posted: Thu Jan 24, 2013 5:09 pm
by Kiffi
mh, here the webgadget loads the xhtml-file without any problems.

Greetings ... Kiffi

Re: Loading *.xhtml in WebGadget

Posted: Thu Jan 24, 2013 7:49 pm
by Perkin
Weird, I get the Open/Save dialog, as though it's a zip/exe and requires confirmation as to whether it should open it directly (which it would then open it in main browser), or save it to disk.

Can anyone suggest as to what could possibly be difference or any setting I could change?