• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

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?
0
aplelois
Asked:
aplelois
  • 5
  • 2
1 Solution
 
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
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now