How to load an entire HTML page from one website into another - ajax

I have been working on a website www.xyz.com which is hosted on some server. I have been loading forms & contents from www.abc.com using I Frame which is hosted on Azure. We have now decided not to use I Frames and to load the content from www.abc.com using Jquery AJAX. Now the abc.com is providing me the UI page fragment for my forms and contents from Azure blob storage in form of .html file or .txt file. If i try to do a normal AJAX call for the HTML or TXT file path, i can the see the content coming in the Response tab of that URL but the code does not enters the Success template and hence i am unable to modify or access the content.
Please suggest

You can use Application Request Routing (ARR) for this. This is a module you can install in IIS which also works in Windows Azure.
The following image illustrates how ARR works. An incoming request is intercepted and based on a set of rules the request is forwarded (for you this will be to xyz.com) and the response is the served back to the user. Even though this illustration explains the principle with sub directories, it can also be applied on the full site.

Related

Delphi: Log the GET request URLs used in Websites that are updating content via AJAX (TWebbrowser)

Using a TWebBrowser in Delphi, I'm showing a website that uses JSON to update its content. To get the source code of the newly updated content and load it into a Memo, I believe I have to get the URLs of the GET requests. Unfortunately, these are always different and generated with an encrypted Javascript. Is there any way to list the URLs the GET requests go to in a similar way like FireBug does in its console view?
Thanks a bunch!!!

Making content accessible on Addon SDK

I am developing an addon using Firefox's Addon SDK (v. 1.11). My extension dynamically creates an iframe on each website and then loads an html file which includes other resources such as images, font files, etc. from the add on's local directory.
Problem
When loading any of such local resources (i.e.: "resource://" schema), the iframe fails to display them and a message is thrown:
Security Error: Content at http: //www.XXX may not load or link to
resource://XXX
This is a security measure introduced on Firefox 3. When developing without the Addon SDK, the way around it is declaring a directory with "contentaccessible=yes", making the directory's contents accessible to anyone, including my add on. However, I have not been able to find similar functionality using the Addon SDK. Is there a better way of using local data on an iframe that my addon creates and inserts into a page?
I don't think you can directly load an iFrame that points to a resource inside your URL. The browser complains because it's either breaking same origin policy or cross site scripting one. I can't remember which one right now.
if it is html content you want to load you can always inject it into the DOM and then send a message to the document object using the events API to display your custom html. I've done this in the past and it works.
so from main.js send a message to content script which will then inject your iframe html into the DOM and then you can send the document object a message to display it.
I hope this helps.
Not sure if this was the case when you posted the question, but it appears that "resource://" should no longer be used with the Addon SDK.
If you're using the resource inside of an HTML file in the extension, you can reference it locally, otherwise you should use data.url('whatever.jpg') and pass around that value as needed.
Full info is here: http://blog.mozilla.org/addons/2012/01/11/sdk-1-4-known-issue-with-hard-coding-resource-uris/

HTML 5 Web Storage - Local/server communication

I need load localStorage data right on my homepage. But when the page loads, the PHP/SQL instructions are already processed.
There's a way to process it before the server interation and use the localStorage data in my SQL instructions?
ps. I tried AJAX, loading my homepage in a DIV inside an index page... but it didn't work.
The answer is no - you can't read the LocalStorage data on the first load of your web site. However, you can use Ajax to hit your server and send a copy of any LocalStorage value to your server. You mentioned using ajax to load your homepage in a div. That should work, if you pass along the LocalStorage information in the url. So for example, imagine you have a localstorage key called name. If you want to load the contents of foo.php into a div and have PHP get access to name, you would pass it in the URL: "foo.php?name="+escape(localstorage.name)". You can also use a Form post too.

How to refresh jquery mobile multipage document after deploying new software

I have a jqm multipage document (index.html) that includes several pages and other assets (js, css, etc.). I have my server configured to use etags for the html, css, and js files. The request/response headers are set appropriately and it works as expected.
During use of my application there are no requests (with the exception of signing off) to index.html, so there is never really a chance for the browser to see if there is a new file out there, let alone all of it's css and js files (unless the user signs off, requests the page again or does a refresh). If I deploy new software, how might I notify the user that new sw is available and/or somehow force a refresh of the index.html file?
My initial thoughts were to store the version # on the client and periodically make ajax requests to the server to check the version #. If new sw is available, display a link to notify the user informing them of the new sw and to click on the link to get it (reload index.html).
I'm curious how others have done this? Thoughts? Recommendations?
If you link to multipage document, you must use a data-ajax="false"
attribute on the link to cause a full page refresh due to the
limitation above where we only load the first page node in an Ajax
request due to potential hash collisions. There is currently a subpage
plugin that makes it possible to load in multi-page documents.
Reference: http://jquerymobile.com/demos/1.1.0/docs/pages/page-navmodel.html
Please also look at this:
Cases when Ajax navigation will not be used
Under certain conditions,
normal http requests will be used instead of Ajax requests. One case
where this is true is when linking to pages on external websites. You
can also specify that a normal http request be made through the
following link attributes:
rel=external
target (with any value, such as "_blank")
If the pages is loaded as http request instead of Ajax, the problem would be solved.

Internet Explorer does not load images cross domain (https)

this is an updated question:
I am trying to include a picture on an external server.
PROBLEM HERE: my home website is using https:// and the picture on the external server is just http. The picture is fine (tested) but IE seems not to allow to access http:// sources when on a https:// website.
I am looking for html or javascript code to allow access for loading pictures from other domain WHEN my home domain is HTTPS and my external domain is HTTP
thanks
Klaus
I'm afraid this is a feature of the browser. When you enter a page like this on IE and some other browsers, it will give the user the option to disallow "unsecured" elements on the page (this includes elements served over HTTP); and will not display them. Your page cannot override the users' action.

Resources