Disabling Javascript/Ignoring a certain line of code?

hello,
I have this button
WebBrowser1.Navigate(New System.Uri(" domain .com / page php"))

this page has this code in it but I dont want to see it I want to disable it!
or ignore those lines

<script language="Javascript">
<!--
paid_ads("Frame2");
//-->
</script>

how can I do that?
apleloisAsked:
Who is Participating?
 
KudzullcCommented:
I understand your concern for posting in wrong sections.  I am trying to determine 'if' aplelois was able to use another technology along with .NET or Javascript.  Also, as an example, I have created an instance where a user might be able to disable/ignore javascript using ColdFusion. As far as .NET solutions, the short answer to this problem is no, you can not disable javascript in WebBroswer. You have to disable JavaScript in your Explorer options.As for ways around the problem, you can download the HTML of the webpage using an Internet Transfer Control, hack out the script from the string (rewrite relative links if necessary) and then write the string into the browser. Another way around the problem is to write a secure frame into the webbrowser, and then navigate the frame to the URL, as shown below.  

JavaScript cannot work inside a secure frame.

Private Sub Command1_Click()
SecureNavigate WebBrowser1, "http://www.microsoft.com"
End Sub

Private Sub SecureNavigate(WB As WebBrowser, URL As String)
WB.Navigate2 ("about:blank")
With WB.Document
 .open
 .write "<html><head><title>Secure Frame</title></head>"
 .write "<frameset frameborder=no border=0 framespacing=0>"
 .write "<frame name=secureFrame security=restricted scrolling=yes src="
 .write URL
 .write "></frameset></html>"
 .Close
End With
WB.Refresh
End Sub

Now we on track?  =O)

gl,
Lucas
0
 
strickddCommented:
I'm not quite clear what you're asking. Are there certain instances where you want Javascript to fire for a specific action and thime when you don't want it? If you just don't want it at all take it out. If it is a conditional type thing you can use Control.EnableClientScript = (true/false).
0
 
KudzullcCommented:
are you using anything other than Javascript?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
KudzullcCommented:
For instance, If I was using ColdFusion I could have the page look for a url parameter...

like this

<cfif 'url.skip' EQ 1>
script language="Javascript">
<!--
paid_ads("Frame2");
//-->
</script>
</cfif>

When you entered the url from the button event, the WebBrowser1.Navigate(New System.Uri(" domain .com / page php?skip=1")) ( added a little the the end) this url paramenter will skipp the code  in the page.  PHP is very similar if I am not mistaken....


otherwise the code gets read.

gl,
Lucas
0
 
KudzullcCommented:
err this works better

<cfif isdefined('url.skip') AND 'url.skip' EQ 1>
script language="Javascript">
<!--
paid_ads("Frame2");
//-->
</script>
</cfif>
0
 
KudzullcCommented:
ha, oops, are you even able to edit the html?

didnt notice that you might not be able to access the source for changes.
0
 
strickddCommented:
If this is a ColdFusion question, why did you post it in the VB.Net section? You may want to consider moving it to the proper section.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.