This Q&A viewtopic.php?f=6&t=10433 helped me fix the crash I was getting regarding the same. But it seems like I have to provide source_origin that needs to start with http or https. My issue is that I need to test the same with a local html file. But obviously it crashes because it is not able to find http/https protocol prefix.
My question is that, is there any way I can work with CefAddCrossOriginWhitelistEntry and a local file as source_origin ? Any help will be greatly appreciated. Thanks.
Consider testdomain.com to be hosted in a remote server, and has proper permissions to allow cross origin access or otherwise known as "Access-Control-Allow-Origin".
- Code: Select all
#include "cef_origin_whitelist.h"
...
//inside a function
// CefAddCrossOriginWhitelistEntry("http://source.mydomain.com", "http", "testdomain.com", true); //this works without crash.
CefAddCrossOriginWhitelistEntry("H:/test/sample.html", "http", "testdomain.com", true); // this crashes. I am assuming because source is not a http or https url
sample.html:
- Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>sample</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>
</head>
<body>
<h1>sample</h1>
<p><a href="#">Click here</a></p>
<div id="result">
</div>
<script type="text/javascript">
//JavaScript AJAX code here
$(document).ready(function()
{
$('a').click(function()
{
$('#result').load('http://www.testdomain.com/index.html');
});
});
</script>
</body>
</html>