I give customers javscript code that adds a widget to their website.
Currently I ask them to paste this right above the </body>
tag:
<script type="text/javascript">
var myHost = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + myHost + "www.mywebsite.com/mycode.js.php?u="+encodeURIComponent(window.location.host)+"' type='text/javascript'%3E%3C/script%3E"));
</script>
As you can see the code calls my script under http or https url depending on the page url.
Sometimes when a website html is not well formed the script can cause "operation aborted" bug on IE browsers.
I want to send customers code that will be attached to the <head>
area.
- How can I handle the http/https when calling code from head part?
- Do you know if it will solve the operation aborted problem?