问题
Hello can anyone help me with an embed question? I need to know what code I use to allow users to use on thier own websites, kinda like disqus and other websites were there is an embed code and it just prompts you to copy and paste it How can I do this for my slider tool so users can use it on there own websites
回答1:
Here's some sample code from a similar question asked in the past:
<script type='text/javascript' charset='utf-8'>
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.src = 'URL OF CONTENT YOU WANT TO PROVIDE';
iframe.width = 'THE WIDTH YOU WANT';
iframe.height = 'THE HEIGHT YOU WANT';
</script>
More info here: https://stackoverflow.com/a/14099243/1905554
回答2:
If you mean to use your JavaScript code on their website use then:
<script type='text/javascript' src='absolutePathwhereTheyGetYourCode'></script>
Just have them copy and paste the code right before the </body>
closing tag, like:
<script type='text/javascript' src='absolutePathwhereTheyGetYourCode'></script>
<script type='text/javascript'>
// now they can use your code here
</script>
</body>
来源:https://stackoverflow.com/questions/19260103/can-anybody-help-me-create-an-embed-code-for-my-users