-1

I am working on a javascript/html webpage, which consists of a simple table and a button.

When i click on the button, i want it to go to a certain website say, www.website.com, check a few radio buttons and hit enter all automatically.

i wanted to know whether this can be done by javascript/jquery only. if so please specify how. Thank you.

rere
  • 19
  • 1
    Sounds dubious... Probably could be achieved with frames though. – Corey Ogburn Sep 20 '12 at 16:35
  • @Vivin: i am new to javascript..till now i have just created the basic webpage using html...i am struck with the javascript part.. – rere Sep 20 '12 at 16:38
  • 1
    @Jashwant : I disagree. by all means ; ASK THINGS! It's a quicker way to learn. – Timothy Groote Sep 21 '12 at 07:32
  • @TimothyGroote, ask things when you confusion and problems and you wont have problems until you learn/study something. Some people just ask questions, because they want to do something with particular technology, without learning it. Like if I say , how can I do an ajax request in python ? ( I do not know abc of python ) – Jashwant Sep 21 '12 at 13:23
  • Naturally, one should not begin by asking everything about the basics, learn what you can on your own, but when in doubt, ask. It's a good way to learn about all the aspects of your specific problem, and in this case (browser security) it gets complicated very very quickly – Timothy Groote Sep 24 '12 at 16:03

3 Answers3

2

You can easily transfer yourself to another web page like this :

window.location="http://www.somewebsite.com";

But once you are there, it's no longer possible to interact with any of the DOM elements.

unfortunately, opening the other website in an iFrame, and then finding and setting the elements you want to change inside the iFrame will not work. In general, browsers will disallow it because it poses a security risk.

Timothy Groote
  • 8,614
  • 26
  • 52
  • 1
    ... except that the browser won't allow manipulation of the contents of a frame containing stuff from another domain. – Pointy Sep 20 '12 at 16:39
  • hmm that makes sense, it could be a severe security risk if this was not the case... – Timothy Groote Sep 20 '12 at 16:45
  • How do I gather data from another website and store the information on my own? For example, I want to gather the top 10 players on a certain gameworld on an MMORPG game, the link is this: http://www.tibia.com/community/?subtopic=highscores&world=Antica As you can see in the website, it shows a list of 25 player names with their rank, level, and experience. I want to be able to use JavaScript and extract data of the top 10 players and print the rank, name, level, experience of those players on my own website. I just want to know how to get data from a website and print it on my own website. – rere Sep 20 '12 at 17:12
  • To put it simple : you can not do this using only javascript. A lot of thought went into keeping Javascript away from being a useful attack tool. Using javascript, you cannot get information from another domain unless that other domain specifically allows it. If Tybia has a public API, or an RSS feed that contains the scores, you could probably use that though. – Timothy Groote Sep 20 '12 at 17:15
  • You're welcome, wish i could have been of more help. I learned a bit myself out of this one too :) – Timothy Groote Sep 20 '12 at 17:20
0

You need to look at userscripts to solve this one.

A userscript is a type of browser plugin that has more abilities than regular web pages do, though the plugin must be installed for everyone who is going to use it.

Under Firefox, the plugin is called GreaseMonkey. Chrome has some userscript ability built in, or one can use TamperMonkey Beta.

Jeremy J Starcher
  • 23,369
  • 6
  • 54
  • 74
-1
<div id="page"></div>

Using jquery load the div

$('#page').load('http://www.google.com');

Now the contents of the page will be available in the div

using find(), children()

do get the necessary tags!

madhairsilence
  • 3,787
  • 2
  • 35
  • 76
  • Unfortunately, as you can see in this jsFiddle: http://jsfiddle.net/hssC8/ that does not work either. The load request is stopped by the browser because it recognises it as cross-domain – Timothy Groote Sep 20 '12 at 17:11
  • So XSS could be achieved if the request is done server side? i.e. my site could ask my server to make the request and return the content? Interesting... – Corey Ogburn Sep 20 '12 at 17:17
  • Simply put, yes. It's only a matter of time until the target finds out the requests are coming from your server and block you though. – Timothy Groote Sep 20 '12 at 17:21