How to set referrer for Javascript with awesomium 1.7.4.2

317 Views Asked by At

Trying to set the referrer through a CustomResourceInterceptor.

This code does not work:

request.AppendExtraHeader("Referer", "somereferrer.com");

Header is not sent.

This code works:

request.Referrer = "somereferrer.com";

Header is sent. BUT referrer receives only the server and can be seen in the server variable $_SERVER['HTTP_REFERER']. Of javascript referrer does not get in the variable document.referrer is empty. Respectively the counters counts both direct transitions.

Got to do so by calling the event webView.DocumentReady:

webView.ExecuteJavascript("delete window.document.referrer;window.document.__defineGetter__('referrer', function () { return 'somereferrer.com';});");

But this is not the right way. This crutch works not always. There must be a way to allocate it correctly.

How to make the referrer passed and the client side too? As it can be properly implemented?

0

There are 0 best solutions below