Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#Javascript
I used the parser in my application but I cannot run properly.
My input to the parser is a html file and I want to run the commands and links within JavaScript code, it will give the output in the parser jurassic.
 
My code is :
var engine = new Jurassic.ScriptEngine();
                           var scriptsource = new Jurassic.StringScriptSource(Uri.UnescapeDataString(html), null);
and :
try
                           {
                               var ans = engine.Evaluate(Uri.UnescapeDataString(u1.URI.AbsolutePath));
                               u1 = new URL(engine.GetGlobalValue("document.location.href").ToString());
                           }
 
                           catch (Exception ex)
                           {
                               System.Windows.Forms.MessageBox.Show(ex.Message);
                           }
When i trace my code, this part, it does not run. Is there another code for it?
and for some url (for example bg.888.com), jurassic can not run functions that there is javascript links.
Posted 27-Apr-13 18:55pm
e.v.r412
Edited 28-Apr-13 0:51am
v4
Comments
Richard MacCutchan at 28-Apr-13 4:02am
   
What is the problem? If you want help then you need to give more details. Please use the "Improve question" link and edit your question.
e.v.r at 28-Apr-13 4:24am
   
Thank you.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I think it should be like this:
 
// First, give U1 a value...
u1 = new URL(engine.GetGlobalValue("document.location.href").ToString());
// ... and only later use it.
var ans = engine.Evaluate(Uri.UnescapeDataString(u1.URI.AbsolutePath));
 
Hope this helps,
Pablo
  Permalink  
Comments
e.v.r at 29-Apr-13 3:26am
   
Thank you! In fact, my problem is here: var scriptsource = new Jurassic.StringScriptSource(Uri.UnescapeDataString(html), null); in part, html code has to read, but Jurassic can not parse this source so any time syntaxs in try block, do not run.
Pablo Aliskevicius at 29-Apr-13 4:54am
   
It may be an issue with Jurassic itself. Did you try to post one at their site? http://jurassic.codeplex.com/workitem/list/basic They have an 'issue tracker', and you can report bugs there.
e.v.r at 29-Apr-13 5:03am
   
Thank you. I try but any body don't answer me. :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 480
1 Tadit Dash 305
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 190
4 OriginalGriff 163
0 Sergey Alexandrovich Kryukov 9,435
1 OriginalGriff 5,498
2 Peter Leow 4,230
3 Maciej Los 3,540
4 Abhinav S 3,353


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 28 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid