内容更换外部网站 [英] Content replacement from external website

查看:121
本文介绍了内容更换外部网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我pretty的新的jQuery和JavaScript将军我喜欢简单的load()的功能,jQuery使用。我的问题:是否有可能从外部网站使用load()函数加载内容

So I am pretty new to jQuery and Javascript in Gen. I like the simple load() functionality that JQuery uses. My question: Is it possible to load content from an external website using the load() function?

$(#placeholder).load("http://wwww.facebook.com/someuser");

特林同步将被加载到#placeholder DIV特定的Facebook页面上的内容。

tring to sync content on a specific facebook page that will be loaded into #placeholder div.

推荐答案

在一般情况下,没有你,出于安全原因。

In general, no you can't, for security reasons.

有几个选项:

  1. 使用 JSONP - 这需要服务器支持该格式返回数据
  2. 使用的< IFRAME> 来模拟你后的效果
  3. 使用代理服务器上 - 例如, PHP脚本传递给它返回的URL的内容的URL。因为你的服务器发出请求,而不是客户端,你就不会被登录到外部网站。
  1. Use JSONP - this requires the server support returning data in that format.
  2. Use an <iframe> to simulate the effect you're after
  3. Use a proxy on your server - e.g. a PHP script you pass a URL to which returns the content of that URL. Because your server is making the request, not the client, you won't be "logged in" to the external site.

这篇关于内容更换外部网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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