Caption and HTMLRenderer
2 posts
• Page 1 of 1
Caption and HTMLRenderer
While defining an HTMLRenderer the following example works as described in the documentation and the caption of the form will be 'Title Wins':
However when using the URL method and loading an HTML file that has no <title> markup the caption of the form will be the name of the file loaded and if there is a <title> markup in the file it will the caption of the form:
This makes it impossible to load an HTML file and have control over the caption of the resulting form (we write the customer name in the caption of the form in our case with our company logo).
Is this the expected behavior ? In the affirmative is the workaround would be to do a regular form and have the HTMLRenderer specified has a child or there is a better idea ?
html←'<title>Title Wins!</title>Test'
'hr' ⎕WC 'HTMLRenderer'('HTML' html)('Caption' 'Caption Wins!')('Size' (10 20))
However when using the URL method and loading an HTML file that has no <title> markup the caption of the form will be the name of the file loaded and if there is a <title> markup in the file it will the caption of the form:
'hr' ⎕WC 'HTMLRenderer'('URL' 'file:///D:\NoTitle.html')('Caption' 'Caption Wins!')('Size' (10 20))
This makes it impossible to load an HTML file and have control over the caption of the resulting form (we write the customer name in the caption of the form in our case with our company logo).
Is this the expected behavior ? In the affirmative is the workaround would be to do a regular form and have the HTMLRenderer specified has a child or there is a better idea ?
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: Caption and HTMLRenderer
Hi Pierre,
First, I apologize for not responding earlier. Either the notification of your post didn't arrive in my inbox, or I somehow missed it.
Yes, this is the expected behavior. The caption should really be set with the <title> element. In the absence of a <title> element, Chromium will display the URL of the requested resource; in this case, the file name. That's how browsers work.
Further, you can introduce an incongruity between the displayed caption and what the DOM thinks is the document title. For instance, if you have an HTML file with a <title> element and subsequently set the renderer.Caption property to something else, the DOM thinks the title has not changed. To actually set the caption, and have the DOM be in sync, I would use something like renderer.ExecuteJavaScript 'document.title="My Title"'.
I hope this helps!
/Brian
First, I apologize for not responding earlier. Either the notification of your post didn't arrive in my inbox, or I somehow missed it.
Yes, this is the expected behavior. The caption should really be set with the <title> element. In the absence of a <title> element, Chromium will display the URL of the requested resource; in this case, the file name. That's how browsers work.
Further, you can introduce an incongruity between the displayed caption and what the DOM thinks is the document title. For instance, if you have an HTML file with a <title> element and subsequently set the renderer.Caption property to something else, the DOM thinks the title has not changed. To actually set the caption, and have the DOM be in sync, I would use something like renderer.ExecuteJavaScript 'document.title="My Title"'.
I hope this helps!
/Brian
-
Brian|Dyalog - Posts: 119
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group