From an external resource I get URLs for trackers that I need to execute/load in the DOM, but a URL with a # in it, gets cut off after the pound sign, whatever I try. I have no control over these URLs as they come from a 3rd party, I want to be able to load this URL without any modification to it.
An example URL: http://www.example.com/resource.js?param1=testvalue#a=b&c=d&f=g&js=.js
When executed this URL changes into: http://www.example.com/resource.js?param1=testvalue
The code that I'm sharing works in all cases, except for the URL above.
Original code:
$('#myElement').append('<SCRIPT language="JavaScript1.1" SRC="' + url + '"></SCRIPT>')
What I tried too:
var s = document.createElement("script")
s.type = "text/javascript"
s.src = url
$('#myElement')[0].appendChild(s)
And other variations with appending the child, I tried to insert it as an image element too, but that didn't work either.
The only other post I could find on this suggests that the browser does this (jQuery Ajax Call on URL with Pound (Number) Sign )...seems logical, but the company we're not the first client of this company...