[英]How to add third party url script and link in the head tag using js?
Eg:例如:
var RequestURL = '';
function onWindowClosed(obj) {
/*This is the function where you need to handle callback object based on various codes
If the event name passed by you is not matched with the returned one then you can call the logout functionality, as there are some error occured inside the WEB.
*/
console.log("callback event : " + JSON.stringify(obj));
if (obj.event_name === event_name) {
/*your event is returned here.*/
console.log("successfully returned: " + obj.message);
}
else {
/*handle other event names here. It may be any
unknownEvent,init,capture,initiateAndCapture */
console.log("event not returned");
}
}
var userDetails= JSON.stringify({
"appId": ",
"customerId": "",
"user_type" : "",
"name" : "",
"transaction_date" : "",
"city": "" //optional
// any other parameters on which the response needs to be analyzed should be included here.
});
var params= {
"event_name":"myEvent"
};
You can append elements like scripts or stylesheets using vanilla JavaScript您可以使用 vanilla JavaScript 附加脚本或样式表等元素
var script = document.createElement("script"); script.setAttribute("src", "https://script.example.com/script.js") // Replace with your script link var head = document.querySelector("head") head.appendChild(script)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.