替代的Iframe [英] Alternatives to Iframe

查看:233
本文介绍了替代的Iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发,允许用户通过使用内置页框插入从我的数据库中的信息到他们的网站的服务。唯一的问题是,iframe的需要是调整大小,这是最大的问题,内置页框一个作为大多数人都已经知道,藏汉一个事实,我可以在父页面上从内部的iframe,反之亦然访问对象。

I have been developing a service that allows users to insert information from my database onto their sites by using iframes. The only problem was that the iframe needs to be resizeable and this is one of the biggest problems with iframes as most people already know, aswell as the fact I can access objects on the parent page from within the iframe and vice versa.

我也曾想过做一个asp.net网站役服务器了HTML,并通过使用GET请求来访问它。然而,这也有一个问题,因为这些请求只能从相同域进行?

I have thought of making an asp.net web servie to server up the HTML and access it by using a get request. However this also has a problem since these request can only be made from the same domain?

我需要知道的是,以取回一小块包含HTML顾客评论来自服务器,并使用某种形式的AJAX在他们的页面上显示它的最佳方式。

What I need to know is the best way to retrieve a small piece of HTML containing customer reviews from server and display it on their page using some sort of AJAX.

感谢

推荐答案

如果您的用户可以添加< SCRIPT>行到他们的网站指向您网站上的code,你可以很容易提供给从您的网站内容建立自己的网页,你jquery.load浮动(和resizable)DIV()的机制?

if your users can add a < script > line to their site pointing to code on your site, you can fairly easily offer a mechanism to build a floating (and resizable) DIV on their page that you jquery.load() with content from your site ...

例如: 要在网站上使用我的服务,添加下面一行到你&LT; HEAD>

example: "To use my service on your site, add the following line to your < head >"

<script type='text/javascript' src='http://mysite.com/scripts/dataget.js />

然后添加一个链接或按钮的任何地方,并给它一类的获得最新从 - mysite的

then add a link or button anywhere and give it a class 'get-date-from-mysite'

< input type='button' value='Click to see the data' class='get-data-from-mysite' />

-

然后在脚本中,您做的(类似):

Then in that script you do (something like):

$(function() {
    $('.get-data-from-mysite').click(function() {
        $('body').append("<div id='mydiv' 'style=position:absolute; z-index:999; left:                 ...

        $('#mydiv').load(' .... // url that sends html for content
    });
   ...etc

调整-能够股利东西需要添加太

resize-able div stuff needs to be added too

这篇关于替代的Iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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