2

I want the following functions and I know about the client side domain restriction in javascript however I don't know if this restrictions applies to what I want the crawler to do.

  1. Javascript to load the text content of a given website's url address to a div or assign it to a var.

  2. the tags should then be parsed from the text.

3 the body of text should be searched for a specific word. If the word is found it should take the neighbouring sentence including the word and display it on the alert message.

I am writing a firefox application so everthing must be done on client side.

3
  • Is this for a Firefox plugin or for a website? Commented Mar 2, 2011 at 14:37
  • You just answered your own question. Commented Mar 2, 2011 at 14:37
  • Its firefox extensions which retrieves link address when the user hovers over links on any given page Commented Mar 2, 2011 at 14:52

2 Answers 2

3

As you just said, you cannot use Javascript to retrieve arbitrary content from another domain.

However, you could write a server-side proxy in your own domain which forwards requests to arbitrary URLs and passes along the responses.

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

Comments

1

Best and easiest thing you can do is:

  • make a dynamic page on your server that accepts a param: example page.php?url=
  • your javascript will AJAX that page with the url it needs so it can retrive the HTML (thru your php script) and then parse it in js/client

4 Comments

I ve got php server installed, I get the url address from my firefox extensions. Is it possible to make a call from the extension to a php script and the php script responds by sending a body of text to the js
This is completly another question (Is it possible to make a call from the extension to a php script). I gave you the base on how to preceed, if you need specific help on firefox exstension or PHP code open another question :) (select this as answer before XD)
I need urgent help man. I used yboss to search for keywords but it doesn't return good results. I am doing my final year project deadline is in 27th march need to think of another way to implement the behaviour I want so if you know there is a way a php script can be called from your firefox extensions then please do share your knowledge thanks
sorry man never made a firefox ext neither used yboss. Open another question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.