Click here to Skip to main content
11,719,973 members (82,201 online)
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
0 Sergey Alexandrovich Kryukov 2,029
1 OriginalGriff 844
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100