|
-
Sep 13th, 2000, 09:12 PM
#1
Thread Starter
Member
Is there any way that a web browser control can be fed the elements of a page directly from variables stored in memory, i.e., without reliance on addressable files? The features that appear to come the closest to this capability are the innerhtml and outerhtml properties, e.g., brwWebBrowser.document.body.innerhtml = MyString, which are read/write for the body object as well as some other objects. But innerhtml and outerhtml still require at least a shell document to be read from an addressable file, and provide no mechanism for graphics data to be fed from anything other than an addressable file.
John Fritch
-
Sep 14th, 2000, 06:48 AM
#2
Frenzied Member
John
you can write to a webbrowser control using "about:"
Code:
Option Explicit
Private Sub Command1_Click()
Dim strTemp As String
strTemp = "<html><BODY><H1>Is this what you wanted to do?</h1></body></html>"
WebBrowser1.Navigate "about:" & strTemp
End Sub
You could also write the data to out to a temp file and then delete it when it is finished with.
You can include images including animated gifs in a resource file compiled into your program and have that written to a temp file before loading it back into the webbrowser control
-
Sep 14th, 2000, 07:20 AM
#3
Thread Starter
Member
Great! But still no apparent alternative for graphics.
Thanks, Mark.
That sure beats the snot out of what I was doing with innerhtml.
Regarding graphics, yes, I'm writing .gif files, etc., to disk just before loading a page that references them. I then delete such files after the DocumentComplete event fires. I was hoping there would be something as elegant for graphics as what you indicated for normal content.
John Fritch
-
Sep 14th, 2000, 07:56 AM
#4
Frenzied Member
You might be able to load a res
when a page won't load and you get
The page cannot be displayed
this comes from the dll:
res://c:\winnt\system32\shdoclc.dll
in the page is reference to a gif called:
pagerror.gif
Seaching the hard drive while the page was loaded revealed tht it wasn't actually written to the hard drive.
Some time ago, I started looking into how to do this but I got distracted and ended up doing some work!
-
Oct 2nd, 2000, 12:52 AM
#5
New Member
Originally posted by Mark Sreeves
John
you can write to a webbrowser control using "about:"
Code:
Option Explicit
Private Sub Command1_Click()
Dim strTemp As String
strTemp = "<html><BODY><H1>Is this what you wanted to do?</h1></body></html>"
WebBrowser1.Navigate "about:" & strTemp
End Sub
This code won't work if strTemp contains (")
It will show that the page is not available...
How do I solve this?
-
Oct 2nd, 2000, 02:32 AM
#6
Frenzied Member
here's 3 ways which work:
Code:
Option Explicit
Const QUOTE = """"
Private Sub Command1_Click()
Dim strTemp As String
'use a constant...
strTemp = "<html><BODY>" & QUOTE & "Is this what you wanted to do?" & QUOTE & "asked Mark.</body></html>"
'use chr() and the ascii code....
strTemp = "<html><BODY>" & Chr(34) & "Is this what you wanted to do?" & Chr(34) & "asked Mark.</body></html>"
'use html....
strTemp = "<html><BODY>" Is this what you wanted to do?" asked Mark.</body></html>"
WebBrowser1.Navigate "about:" & strTemp
End Sub
-
Oct 4th, 2000, 03:04 AM
#7
New Member
that means you'll have to:
replace(variable, """, "& chr(34) &")
dunno which one is faster compared to saving it to a file and webbrowser1.refresh.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|