2

Let's say I want to write a script to go to a certain Wikipedia page, and then copy and save some text/images into a database (jquery ajax or whatever).

How do I get my script to connect to a website like http://en.wikipedia.org/wiki/Rock_and_roll and then start doing stuff like:

var body_text = document.getElementById(....); 

Hope I explained my goal well enough.

Cheers.

3 Answers 3

3

You cannot do something like that due to cross domain security issues

Sign up to request clarification or add additional context in comments.

1 Comment

arg I thought this was the case. Last time I had to manually download the html source and then run my script on that lol. Any other solutions to accomplish this task? I'll check out nodejs as someone else mentioned.
1

It's true you cannot do what you need using JavaScript from a browser, but it can be done using server-side JavaScript. Take a look at nodejs.org for an example of server-side JavaScript programming.

Comments

1

Its not possible just with browser based JavaScript, but you can use YQL. With yql you can query (theoretically) every website, and get the result as jsonp in your browser.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.