summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2007-08-28 14:18:50 +0000
committerThomas BrĂ¼derli2007-08-28 14:18:50 +0000
commit549a1b6dc0e96bfd5ddebe752d031bd5ed883a92 (patch)
treec316104c5a432dbe7f707fafa689395e682e7b33 /itjs.class
parentae17c5f249a6f8f810bd583ca022d6052d95400e (diff)
downloaditools-549a1b6dc0e96bfd5ddebe752d031bd5ed883a92.tar.gz
itools-549a1b6dc0e96bfd5ddebe752d031bd5ed883a92.tar.bz2
itools-549a1b6dc0e96bfd5ddebe752d031bd5ed883a92.zip
Use <script> tags to enable data loading from foreign hosts
Diffstat (limited to 'itjs.class')
-rw-r--r--itjs.class13
1 files changed, 10 insertions, 3 deletions
diff --git a/itjs.class b/itjs.class
index 86e9e86..22c5730 100644
--- a/itjs.class
+++ b/itjs.class
@@ -21,7 +21,7 @@ class itjs
*/
function send_headers()
{
- if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && !$_REQUEST['itjs_call']) # text/plain breaks Opera 8.51/Linux and IFrame fallback
+ if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && !$_REQUEST['itjs_iframe']) # text/plain breaks Opera 8.51/Linux and IFrame fallback
header('Content-Type: text/plain; charset=iso-8859-1'); # Berni reported some Firewalls to require this
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+10) . ' GMT'); # prevent broken data on IE reloads
@@ -37,8 +37,15 @@ function serialize($values)
{
if ($callback = it::replace(array('[^\w.]' => ""), $_REQUEST['itjs_call']))
{
- $header = "<script type='text/javascript'>$callback(";
- $footer = "," . intval($_REQUEST['itjs_callid']) . ")</script>";
+ $target = $_REQUEST['itjs_iframe'] ? "parent" : "window";
+ $header = "$target.it_loader && $target.$callback(";
+ $footer = "," . intval($_REQUEST['itjs_callid']) . ");";
+
+ if ($_REQUEST['itjs_iframe']) # iframe-based loading required by Opera 7
+ {
+ $header = '<script type="text/javascript">' . $header;
+ $footer .= "</script>";
+ }
}
return $header . itjs::encode($values) . $footer;