local file:/// URLs are missing generated javascript

649 views
Skip to first unread message

Erik Andersen

unread,
Nov 20, 2013, 1:57:24 PM11/20/13
to cefs...@googlegroups.com
Using CefSharp3 attempting to browse to a local (i.e. file:/// style) URL
shows some autogenerated javascript and style elements are missing.

When browsing to a URL such as i.e. file:///Y:/testfiles/ using Google Chrome,
doing a View Source shows some embedded autogenerated javascript and
style elements, such that the actual directory listing is implemented using a
series of script calls to an autogenerated javascript addRow() function.
i.e.
<script>start("Y:\\testfiles\\");</script>
<script>addRow("..","..",1,"0 B","11/20/13 2:46:12 AM");</script>
<script>addRow("start_here.htm","start_here.htm",0,"6.4 kB","3/23/05 10:39:44 AM");</script>
[------snip-----]
</head><body></body></html>

Using CefSharp3, doing a View Source shows the same addRow() function
calls.  However the embedded autogenerated javascript and style content
is missing, so the script fails, and (obviously) nothing is listed.

I checked, and the same thing happens with CefSharp1.

Czarek Tomczak

unread,
Nov 23, 2013, 4:34:34 AM11/23/13
to cefs...@googlegroups.com
Hi Erik,

On Wednesday, November 20, 2013 7:57:24 PM UTC+1, Erik Andersen wrote:
Using CefSharp3 attempting to browse to a local (i.e. file:/// style) URL
shows some autogenerated javascript and style elements are missing.

Have you tried setting some browser options like "file_access_from_file_urls_allowed"
and "universal_access_from_file_urls_allowed"?

Best regards,
Czarek 

Per Lundberg

unread,
Nov 27, 2013, 4:26:36 PM11/27/13
to cefs...@googlegroups.com
Hi,

Like Czarek suggests, this is probably a good idea. Here is the relevant header file: https://github.com/cefsharp/CefSharp/blob/CefSharp3/CefSharp/BrowserSettings.h
(The settings in question seem to be commented out right now. Feel free to fix and send a pull request. I think there was some problem preventing it from be used straight away with CEF3, since the interface changed to a "three-state boolean" - true, false and unset (meaning the default should be used). But you can see how it's been done with the other booleans, so it should be straightforward to fix this.)

Oh, and sorry about the code smell. :) Commented out code is one of the worst things I know of...

Best regards,
Per
Reply all
Reply to author
Forward
0 new messages