private void newbrowser()
{
WebConfig config;
config.referrer = "ref";
config.useragent = "useragent";
//^Code completion should help with finding the correct names, but that should be it.
WebCore.Initialize(config);
browser = new Awesomium.Windows.Forms.WebControl();
//delay until control is ready
browser.Paint += browser_Paint;
tabPage1.Controls.Add(browser);
browser.Location = new System.Drawing.Point(1, 1);
browser.Name = "webControl";
browser.Size = new System.Drawing.Size(1024, 768);
browser.Source = new System.Uri("https://www.google.com", System.UriKind.Absolute);
browser.TabIndex = 0;
}
Hey man, many thanks, but there's something strange...
this is my code
i've this 2 errors:Code:private void newbrowser() { WebConfig config; config.referrer = "ref"; config.useragent = "useragent"; //^Code completion should help with finding the correct names, but that should be it. WebCore.Initialize(config); browser = new Awesomium.Windows.Forms.WebControl(); //delay until control is ready browser.Paint += browser_Paint; tabPage1.Controls.Add(browser); browser.Location = new System.Drawing.Point(1, 1); browser.Name = "webControl"; browser.Size = new System.Drawing.Size(1024, 768); browser.Source = new System.Uri("https://www.google.com", System.UriKind.Absolute); browser.TabIndex = 0; }
Error 1 'Awesomium.Core.WebConfig' does not contain a definition for 'referrer' and no extension method 'referrer' accepting a first argument of type 'Awesomium.Core.WebConfig' could be found (are you missing a using directive or an assembly reference?) C:\Users\xxx\Documents\Visual Studio 2010\Projects\xxx\xxx\Form1.cs 40 24 xxx
Error 2 'Awesomium.Core.WebConfig' does not contain a definition for 'useragent' and no extension method 'useragent' accepting a first argument of type 'Awesomium.Core.WebConfig' could be found (are you missing a using directive or an assembly reference?) C:\Users\xxx\Documents\Visual Studio 2010\Projects\xxx\xxx\Form1.cs 41 24 xxx
browser.[COLOR=#2B91AF]SetHeaderDefinition[/COLOR]([COLOR=#800000]"MyHeader"[/COLOR], myCol);
browser.[COLOR=#2B91AF]AddHeaderRewriteRule[/COLOR]([COLOR=#800000]"http://*"[/COLOR], [COLOR=#800000]"MyHeader"[/COLOR]);
What version are you using?Man thsnk you again...
but i've another 2 errors..
Code:browser.[COLOR=#2B91AF]SetHeaderDefinition[/COLOR]([COLOR=#800000]"MyHeader"[/COLOR], myCol); browser.[COLOR=#2B91AF]AddHeaderRewriteRule[/COLOR]([COLOR=#800000]"http://*"[/COLOR], [COLOR=#800000]"MyHeader"[/COLOR]);
Error 1 'Awesomium.Windows.Forms.WebControl' does not contain a definition for 'SetHeaderDefinition'
Error 1 'Awesomium.Windows.Forms.WebControl' does not contain a definition for 'AddHeaderRewriteRule'
thank you for your patience
hey capripio, thank you for the reply, i use c#, xulrunner can run in c#?Well I suggest you to use xulrunner!
hey capripio, thank you for the reply, i use c#, xulrunner can run in c#?
i need something simple that can run for example 5 webrower each with different useragent and different referrer
thank you!
internal class ResourceInterceptor : IResourceInterceptor
{
public bool OnFilterNavigation(NavigationRequest request)
{
return false;
}
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request)
{
if (request == null) return null;
request.AppendExtraHeader("User-Agent","ua here" );
request.Referrer = "referrer here";
}
}
void StartWebCore(){
...
WebCore.Started += WebCoreOnStarted;
}
static void WebCoreOnStarted(object sender, CoreStartEventArgs coreStartEventArgs)
{
var interceptor = new ResourceInterceptor();
WebCore.ResourceInterceptor = interceptor;
}
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request)
{
if (request == null) return null;
request.AppendExtraHeader("User-Agent", "ua here");
request.Referrer = "referrer here";
}
hey rootjazz, thank you for the help, i've got this error
Error 1 'WindowsFormsApplication1.Form1.ResourceInterceptor.Awesomium.Core.IResourceInterceptor.OnRequest(Awesomium.Core.ResourceRequest)': not all code paths return a value
on this
Code:ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request) { if (request == null) return null; request.AppendExtraHeader("User-Agent", "ua here"); request.Referrer = "referrer here"; }
return null;
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request)
{
if (request == null) return null;
request.AppendExtraHeader("User-Agent", "ua here");
request.Referrer = "referrer here";
return null;
}
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request) {
request.webview
...
internal class ResourceInterceptor : IResourceInterceptor {
public bool OnFilterNavigation(NavigationRequest request)
{
return false;
}
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request)
{
if (request.Method != "GET")
{
return null;
}
request.AppendExtraHeader("User-Agent", useragentok());
request.Referrer = "http://awesomium.com";
return null;
}
}