Loading *.xhtml in WebGadget

Everything else that doesn't fall into one of the other PB categories.
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Loading *.xhtml in WebGadget

Post 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
%101010 = $2A = 42
Seymour Clufley
Addict
Addict
Posts: 1265
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: Loading *.xhtml in WebGadget

Post 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.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: Loading *.xhtml in WebGadget

Post 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.
%101010 = $2A = 42
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Loading *.xhtml in WebGadget

Post by Kiffi »

@Perkin: I cannot reproduce your problem. Do you have a xhtml-file for me?

Greetings ... Kiffi
Hygge
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: Loading *.xhtml in WebGadget

Post 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
%101010 = $2A = 42
User avatar
Kiffi
Addict
Addict
Posts: 1504
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Loading *.xhtml in WebGadget

Post by Kiffi »

mh, here the webgadget loads the xhtml-file without any problems.

Greetings ... Kiffi
Hygge
Perkin
Enthusiast
Enthusiast
Posts: 504
Joined: Thu Jul 03, 2008 10:13 pm
Location: Kent, UK

Re: Loading *.xhtml in WebGadget

Post 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?
%101010 = $2A = 42
Post Reply