473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Loading remote xml

Hello everybody,

I would need to load through javascript a remote xml file (a rss feed)
and then use its content to build the page. I am trying to do something
in my local pc and it works fine in IE but in firefox it seems that
remote files cannot be retrieved. So how would it be possilbe to build
a rss ticker entirely in JS working in firefox? The only solution is an
Ajax call??

Thanks very much to anyone who will be able to help me ;)

J_Z

Nov 30 '06 #1
5 2367
J_Zanetti wrote:
I would need to load through javascript a remote xml file (a rss feed)
and then use its content to build the page. I am trying to do something
in my local pc and it works fine in IE but in firefox it seems that
remote files cannot be retrieved. So how would it be possilbe to build
a rss ticker entirely in JS working in firefox? The only solution is an
Ajax call??
Your script in a HTML document loaded from e.g. http://example.com/ can
only load XML from http://example.com/ but not from other origins.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 30 '06 #2
Martin Honnen ha scritto:
Your script in a HTML document loaded from e.g. http://example.com/ can
only load XML from http://example.com/ but not from other origins.
Martin, thank you for your answer.
I knew about this, but why does it work on IE?? In IE i created rss
tickers with js and they work on my pc (so i guess also from other
servers).
I got lost on this point :S

Thanks so much!

Nov 30 '06 #3
J_Zanetti wrote:
I knew about this, but why does it work on IE?? In IE i created rss
tickers with js and they work on my pc (so i guess also from other
servers).
I got lost on this point :S
IE has different security zones each of which can be configured to allow
such access. So it depends on the zone (e.g. file system, intranet zone,
internet zone, trusted sites) and its configuration whether the access
across domains works in IE or not.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 30 '06 #4
you will need a proxy script on your server on the same domain as the
ajax call, from which the ajax gets its data.

this gets called by the ajax script.
<?php
header( 'Content_type: text/xml' );
readfile( 'http://remote.domain.com/rss/feed.xml' );
?>

you make the proxy as complicated as it needs to be, so that it
retrieves multiple rss for your XHR calls.

It's not hard to make so there must be a tonne of them out there, they
are even used for flash as well, because of its crossdomain
restrictions.

Also it's a VERY good idea to parse the remote rss scripts first to
remove the possibility of introducing XSS attacks into your html by
directly including the remote scripts. Its my opinion that php or a
server side language would have a much better chance of collecting
feeds which require cookies or other crendentials as well, so a pure JS
implementation would have feature limitations.

Nov 30 '06 #5

shimmyshack ha scritto:
you will need a proxy script on your server on the same domain as the
ajax call, from which the ajax gets its data.
Thank you shimmyshack!

I see this is a nice workout for a serverside application! Looks very
interesting and powerful!
Though, i start to think there's no solution for a client script that
makes the job in Firefox at least...

Thanks again!

Dec 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brent | last post by:
I maintain a Sql Server database application whose forms are compiled in a .dll and kept in a remote web folder. The main .exe looks to the web folder to see if this .dll exists. If so, then it...
4
by: Razzbar | last post by:
I need to be able to conditionally load a remote script, using the "<script src=..." syntax. Or some other way. I've seen people writing about using the document.write method, but it's not working...
1
by: | last post by:
I have two assemblies with exactly the same name, but which are different; one is on the local machine and the other comes from a remote one. I want to deserialize an object which is of a type...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
0
by: Jeff | last post by:
Hello, I've run into a problem with my asp.net application and would like to know whether the error is likely with my remote host. The problem is an unhandled exception, and the exception...
2
by: Jeff | last post by:
Hello, I've run into a problem with my asp.net application and would like to know whether the error is likely with my remote host. The problem is an unhandled exception, and the exception...
2
by: hbchai | last post by:
I'm adapting the ajax-like asynchronous request pattern mentioned in this article: http://www.xml.com/pub/a/2005/11/09/fixing-ajax-xmlhttprequest-considered-harmful.html?page=2 for my Sudoku...
0
by: the_kiddie98 | last post by:
Hi, I have a C# project which handles web requests to a server. On my local machine, I can usually attach to aspnet_wp once and debug file (hitting breakpoints), however if I stop and want to...
6
by: Gouri.Mahajan7 | last post by:
Hello, When I press the button on the web page I am loading the user control on the web page. This user control is invoking some methods of the web service. The control on the web page is loaded...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.