Android Question WebView Question

tdocs2

Well-Known Member
Licensed User
Greetings, all.

Thank you for answering my question.

Obviously, I am missing a basic format building block.

How do I load the following into a Webview?

B4X:
<iframe src="https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=f4knsvmphom59qn5tbuehdjbqo%40group.calendar.google.com&amp;color=%23853104&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>
Webview1.LoadHTML results in this error:

B4X:
Error description: Undeclared variable 'iframe' is used before it was assigned any value.
Occurred on line: 53
WebView1.LoadHtml(<iframe src="https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=i93gh9idpr1b8euk0a01n7g8fk%40group.calendar.google.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>)
Thank you.

Sandy
 

DonManfred

Expert
Licensed User
try
B4X:
WebView1.LoadHtml("<iframe src='https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=i93gh9idpr1b8euk0a01n7g8fk%40group.calendar.google.com&amp;color=%232952A3&amp;ctz=America%2FNew_York' style=' border-width:0 ' width='800' height='600' frameborder='0' scrolling='no'></iframe>")
But most probably it is better to NOT use iframes!! IFRAME are deprecated (no go) since 15 years ago or so..
 

tdocs2

Well-Known Member
Licensed User
Thank you, Don.

It works! You are clever and quick indeed.

What replaces the iframe?

Best regards.

Sandy
 

DonManfred

Expert
Licensed User
It works! You are clever and quick indeed.
It was nothing clever...

B4X:
WebView1.LoadHtml(<iframe src="https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=i93gh9idpr1b8euk0a01n7g8fk%40group.calendar.google.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>)
LoadHTML needs a STRING a Parameter... Are you giving a STRING there???
 

tdocs2

Well-Known Member
Licensed User
It was nothing clever...

B4X:
WebView1.LoadHtml(<iframe src="https://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=i93gh9idpr1b8euk0a01n7g8fk%40group.calendar.google.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>)
LoadHTML needs a STRING a Parameter... Are you giving a STRING there???
I tried even [QUOTES] but I was missing the fact of the "" embedded in the string.

I stay with the clever remark. My thanks to NJDude also.

Sandy
 

NJDude

Expert
Licensed User
You don't have to write a whole long string to be used with .LoadHTML, I would rather create a small HTML and add it to my assets, in this case, you could save that line in a file called "calendar.html", then to use it, just do something like this:
B4X:
Private myHTML As String

myHTML = File.ReadString(File.DirAssets, "calendar.html")

WebView1.LoadHtml(MyHTML)
That way you don't have to worry about quotes and stuff like that.
 
Top