2

I have an application, I can access them with http or https : http://www.test.com and https://www.test.com In the header of application I load an script for publicity : http://www6.smartadserver.com. If I access the application with http : the publicity are loaded. If I access the application with https, I get the error :

The page at htttps://www.test.com was loaded over HTTPS, but requested an insecure script http‍://www.smartadserver.com. This request has been blocked; the content must be served over HTTPS.

In the header of application I have :

<script src='http://www6.smartadserver.com/config.js?nwid=11111' type="text/javascript"></script>
<script type="text/javascript">
    sas.setup({ domain: 'http://www6.smartadserver.com', async: true, renderMode: 0, inSequence: true });
</script>

Can you help me please?

1 Answer 1

3

Try this way:

<script src='//www6.smartadserver.com/config.js?nwid=11111' type="text/javascript"></script>
<script type="text/javascript">
    sas.setup({ domain: '//www6.smartadserver.com', async: true, renderMode: 0, inSequence: true });
</script>

Section 4.2 of RFC 3986 provides for fully qualified URLs that omit protocol (the HTTP or HTTPS) altogether. When a URL’s protocol is omitted, the browser uses the underlying document’s protocol instead.

So, in usual words, you can avoid strictly setting protocol - and browser will select it automatically.

Sign up to request clarification or add additional context in comments.

1 Comment

Maybe you could explain it a bit to OP? +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.