如何为其他网站创建嵌入代码 [英] How to create embed code for other sites

查看:110
本文介绍了如何为其他网站创建嵌入代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有其他用户可用于其网站和博客的求职门户服务。他们从我的网站复制嵌入代码,将其粘贴到他们的网站并在他们的网页上显示工作板。如何创建此嵌入代码任何人都可以帮助我。



以下是示例monster.com发布者网站



点击获取示例代码按钮。

 < div id =MonsterJobSearchResultPlaceHolderIy8AAA_e_eclass =xmns_distroph>< / div> 
< script type =text / javascript>
(function(){
var oScript = document.createElement('script');
oScript.type ='text / javascript';
oScript.async = true;
oScript.src =('https:'== document.location.protocol?'https://':'http://')+'publisher.monster.com/Services/WidgetHandler.ashx?WidgetID= EAAQgDMlA5vzabXFzuv86ZpLpA - & Verb = Initialize';
var oParent = document.getElementsByTagName('script')[0];
oParent.parentNode.insertBefore(oScript,oP​​arent);
}) ();
< / script>
< a id =monsterBrowseLinkIy8AAA_e_eclass =monsterBrowseLink fnt4href =http://jobsearch.monster.com/browse/>查看更多求职结果< / a>


解决方案

很多方式达到你的目标。因为你没有明确解释你的需要,我只是提供一个简单的例子:

 < script type ='text / javascript 'charset ='utf-8'> 
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);

iframe.src ='您想提供的内容网址';
iframe.width ='你想要的宽度';
iframe.height ='你想要的高度';
< / script>




  1. 根据您的需要修改代码
  2. 在您的html中转义此代码
  3. I have a service of job portal which other users can use for their sites and blogs. they copy embed code from my site, paste it in their site and display job board in their webpage. how create this embed code anyone can help me.

    Here is example monster.com publisher website.

    click Get sample code button.

    <div id="MonsterJobSearchResultPlaceHolderIy8AAA_e_e" class="xmns_distroph"></div>
    <script type="text/javascript">
    (function() {
      var oScript = document.createElement('script');
      oScript.type = 'text/javascript';
      oScript.async = true;
      oScript.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'publisher.monster.com/Services/WidgetHandler.ashx?WidgetID=EAAQgDMlA5vzabXFzuv86ZpLpA--&Verb=Initialize';
      var oParent = document.getElementsByTagName('script')[0];
      oParent.parentNode.insertBefore(oScript, oParent);
    })();
    </script>
    <a id="monsterBrowseLinkIy8AAA_e_e" class="monsterBrowseLink fnt4" href="http://jobsearch.monster.com/browse/">View More Job Search Results</a>
    

    解决方案

    there are many ways to reach your goal. As you didn't explain your need explicitly, I just provide a simple example:

    <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>
    

    1. modify the code according to your need
    2. escape this code in your html
    3. have fun with your awesome embedded widget!

    这篇关于如何为其他网站创建嵌入代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆