Workaround for calling off domain javascript ? (or am I doing something wrong?)
-
Hi All:
I’m trying to write a wordpress plugin that incorporates baseball-reference.com’s B-R Linker functionality with my wordpress installation; however it does not seem to be working:
I tried to bind the javascript code to the “Submit” button on WordPress to no avail; however if I replace the sr_link function’s code with ‘alert(“Testing”);’ it works – I believe it may be an intentional “defect” of javascript to not allow running off domain scripts. If this is the case – is there any way to get around this? or can anyone tell if I am doing anything wrong? Thanks so much.
-MS
[CODE] function sr_link() {
var s=document.createElement(“script”);
s.charset=”UTF-8″;
var rand_param = “rand=” + Math.floor(Math.random()*10000);
s.src=”http://baseball-reference.com/linker/linker.js?”+ rand_param;
void(document.body.appendChild(s));
}jQuery(document).ready(function() {
jQuery(‘#publish’).bind(‘click’, function()
{
jQuery(“#edButtonHTML”).click();
sr_link();});
});
[/CODE]
The topic ‘Workaround for calling off domain javascript ? (or am I doing something wrong?)’ is closed to new replies.