Home Dynamic Javascript appending with location.href attribute and ajax-cross-domain.com script
Reply: 0

Dynamic Javascript appending with location.href attribute and ajax-cross-domain.com script

user753
1#
user753 Published in June 20, 2018, 7:31 am

After assigning this: window.onload = initfunction;

I want to append the AJAX cross domain script to the header:

function initfunction() {
 var dh = document.getElementsByTagName('head')[0];
 var script = null;
 script = document.createElement('script');
 script.setAttribute('src', 'http://whatever.com/cgi-bin/ACD/ACD.js?'+location.href);
 script.setAttribute('type', 'text/javascript');
 dh.appendChild(script);
  }

The script seems to be appended with the correct domain name, but Firebug says: "Failed to load source". If I type a fixed URL within the src attribute it works! e.g.:

script.setAttribute('src', 'http://whatever.com/cgi-bin/ACD/ACD.js?http://google.com');

Any ideas?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.40258 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO