perkiset

This outlines how you can essentially do "cross domain

AJAX

 " using iFrames rather than the XMLHTTPRequestor. This technique definitely has a place at the table.

http://developer.

apple

 .com/inte

rnet

 /webcontent/iframe.html

/p

dirk

Thanks for the link, Ed.

Yesterday I have tested a search function which is displaying
the results on the same page where the function is called in an iframe.

This is simple (as always if you know what you have to do Applause ) and works fine.

But now I want to display the search results in an iframe of
another page (another browser window).

The page should be a .html page, no .

php

  or .cgi. Don't know if this is doable.
Currently my tests are not working.


perkiset

Hey Dirk -

I'm gonna post a

JavaScript

  wrapper around an iFrame call that looks like

AJAX

  but is not hindered by cross domain stuff. I don't know if it will immediately apply, but I think conceptually it may help. But perhaps I'm way off base here - are you saying that you get results from an iframe on browser window (A) and want to display them in browser window (B)? Is this window B already open or not? Why can't browser window (b) go get it's own damn data?  Applause Guess I am unclear on what you are trying to accomplish, and whether it's an iFrame issue or a inter-browser-window issue...

/p

dirk

I will start a search on browser window a and the results should be displayed on browser window b in an iframe.

The following solution is working, but it seems to be too complicated:

Submitting the search request executes a script which stores the search phrase in a temporary file
and opens a new browser window (b) which loads a static HTML page.

The iframe of the new page execute another script which reads the tempary file to get the
search parameters. Then the database is queried and the results are displayed in the iframe.

perkiset

By "temp file" I assume you mean a cookie? If I had to talk between two browser windows I'd use a cookie... but other than that, give what you're describing you're trying to do I don't know that I see any less complicated way. There is a nice cookie class in the

Javascript

  repository, if you need one.

/p

dirk

I meant a normal file, no cookie. But that would imply some session handling.
Otherwise a second visitor could get the search results for the first visitor.

Found a simpler solution:

The URL of the second page is build with a query string, so the search parameter can be appended, like:

http://domain.com/page-b.html?param=keyword

Using

JavaScript

  in page-b.html I can parse the querystring and build the iframe source URL.

<script type="text/

javascript

 ">

var param=unescape(location.search);
param=param.substring(1,param.length);

iframe_url = "search.

php

 ?" + param;
document.write('<iframe src="' + iframe_url + '"></iframe>');

</script>


The script search.

php

  queries the database and displays the results in the iframe.

perkiset

quote author=dirk link=topic=190.msg1214#msg1214 date=1178914726

I meant a normal file, no cookie. But that would imply some session handling.
Otherwise a second visitor could get the search results for the first visitor.

OH WOW - you meant you're storing a file on your server for the second browser? I meant drop a cookie on the client

mac

 hine so that the second browser window could pick it up... now I'm really confused...

can you PM me more details and I could look at where you're going? I suspect that I can assist if you are willing to share a bit more.

/p


Perkiset's Place Home   Politics @ Perkiset's