Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for How can I parse html that includes javascript code [duplicate]

Current License: CC BY-SA 3.0

33 events
when toggle format what by license comment
May 23, 2017 at 12:13 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
S Jul 30, 2012 at 2:24 history edited Community Bot
insert duplicate link
S Jul 30, 2012 at 2:24 history closed Pekka
mario
George Stocker
exact duplicate
Jul 29, 2012 at 20:02 comment added Shawn31313 haha, then that isnt going to work and would be far more difficult
Jul 29, 2012 at 19:57 comment added xtra @Shawn31313 there is no function, it was just an example. The point is it should 'render' all JS functions to html. Just like a modern browser does when you fully load a page.
Jul 29, 2012 at 19:50 comment added Shawn31313 can u post ur link function so i can make my answer perfect for u
Jul 29, 2012 at 18:03 comment added xtra Oh nevermind, I was looking at wrong link.
Jul 29, 2012 at 18:01 comment added BoltClock Those are not in Java. Did you even read them?
Jul 29, 2012 at 18:00 comment added xtra @Adnan, yes but those are in java.
Jul 29, 2012 at 17:58 comment added Adi @xtra, Pekka already gave you 2 links about that.
Jul 29, 2012 at 17:57 comment added xtra Would there be any possibility to emulate browser environment? e.g. in PHP execute like function open_page(google.com) and it would render both js as a browser and save html conent as a text file?
Jul 29, 2012 at 17:35 answer added Shawn31313 timeline score: 1
Jul 29, 2012 at 17:18 answer added Sammaye timeline score: 0
Jul 29, 2012 at 17:17 comment added Vatev @Adnan it may crawl some of them but that does not solve the general case (which a library would have to). Also it will be very difficult to create even a partial solution (you will need a JS interpreter and half of a browser).
Jul 29, 2012 at 17:16 comment added Adi @Pekka, easy easy.. I meant about the server side browser :D
Jul 29, 2012 at 17:16 review Close votes
Jul 30, 2012 at 2:26
Jul 29, 2012 at 17:15 comment added Pekka @Adnan SimpleHTMLDom does not execute JavaScript.
Jul 29, 2012 at 17:14 comment added Adi @Pekka, of course it can. I think Google is doing it to crawl those illusive Javascript navigation "links", right?
Jul 29, 2012 at 17:14 comment added Dejan Marjanović Just use mobile version of the website.
Jul 29, 2012 at 17:14 comment added Vatev @xtra it was just an example. There is no possible way to tell for sure what the link function will do without all the context that a browser creates.
Jul 29, 2012 at 17:13 comment added Adi @Pekka, true. Next time I'll pay more attention to the question :)
Jul 29, 2012 at 17:13 comment added Pekka and Server side browser that can execute JavaScript
Jul 29, 2012 at 17:12 comment added Pekka @Adnan I didn't say it's easy. Just that a DOM parser isn't the answer here :)
Jul 29, 2012 at 17:11 comment added Eric Herlitz Where do you store the HTML-code?
Jul 29, 2012 at 17:11 comment added Adi @Pekka, so he basically wants to read the Javascript code in the page, then execute the function calls and get return values. All of which with PHP. Good luck!
Jul 29, 2012 at 17:11 comment added Šime Vidas So, you want to parse the HTML string with PHP, but then additionally interpret the JavaScript code? Do you have a JavaScript interpreter on your web-server?
Jul 29, 2012 at 17:10 comment added xtra @Vatev, well thats not the case here
Jul 29, 2012 at 17:10 comment added xtra Indeed, simplehtmldom ignores javascript code.
Jul 29, 2012 at 17:09 comment added Vatev I'm pretty sure that is not possible in the general case. What if for example the link function uses the user's mouse coordinates to decide what link to make?
Jul 29, 2012 at 17:09 answer added user149341 timeline score: 0
Jul 29, 2012 at 17:08 comment added Pekka @Adnan that doesn't interpret JavaScript as the OP wants
Jul 29, 2012 at 17:06 comment added Adi How about simplehtmldom.sourceforge.net ?
Jul 29, 2012 at 17:03 history asked xtra CC BY-SA 3.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /