简体   繁体   English

使用iFrame Alternative加载外部Div

[英]Loading external Div using iFrame Alternative

I'm currently designing a eBay listing template for a client in which i have managed to load JavaScript using a loader (www.test4.solowebs.co.uk). 我目前正在为客户设计一个eBay列表模板,在该模板中,我设法使用加载程序(www.test4.solowebs.co.uk)加载了JavaScript。 The JavaScript works in eBay without giving me an error which is fantastic as i used a loader rather than script. JavaScript在eBay上运行时不会给我一个错误,当我使用加载程序而不是脚本时,这是一个奇妙的错误。 What i want is - at the bottom of the listing i want an external div to load from another site, (my own site test4.solowebs.co.uk/featured.html) which has in it two offers. 我想要的是-在清单的底部,我希望外部div从另一个站点(我自己的站点test4.solowebs.co.uk/featured.html)加载,该站点中有两个优惠。 The result of this is that i can change the offers on that page and it will automatically load into all of my listings, a bit like a iFrame. 这样的结果是,我可以更改该页面上的报价,它会自动加载到我的所有列表中,有点像iFrame。 (only problem is eBay does not allow iFrames - and i haven't been able to find a workaround.) (唯一的问题是,eBay不允许使用iFrame,而且我一直无法找到解决方法。)

The Question - Is there a way i can load an iFrame using Javascript? 问题-有什么方法可以使用Javascript加载iFrame? Or an alternate method which will allow me to load a div from an external page? 或其他方法可以让我从外部页面加载div? (as ebay hosts the HTML it will have to be cross-domain compatible!) I'm an expert in HTML CSS and OK at JavaScript so anything other than that will have to be detailed and instructions to implement given. (因为ebay托管HTML,所以它必须是跨域兼容的!)我是HTML CSS的专家,JavaScript很好,因此除此以外的其他任何事情都必须详细说明并提供实现说明。

Thank you in advance! 先感谢您!

Use AJAX, or technically speaking: XMLHttpRequest. 使用AJAX,或者从技术上讲:XMLHttpRequest。

Here's an article on SO about an in-line cross-browser XMLHttpRequest script: Cross-Browser XMLHttpRequest 这是关于SO的有关嵌入式跨浏览器XMLHttpRequest脚本的文章: 跨浏览器XMLHttpRequest

Use it to populate your div asynchronously. 使用它异步填充div。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM