Frontpage JavaScript: Understanding the Code Block

  • Java
  • Thread starter DaveC426913
  • Start date
  • Tags
    Javascript
In summary, the conversation discusses a website that needs to be modified and was built in Frontpage. The code in question is a block of JavaScript that is used to prevent right-clicking and also serves as a browser sniffer. This feature is a built-in function of Frontpage and uses escape and unescape to hide code.
  • #1
DaveC426913
Gold Member
22,497
6,168
I'm looking at this site that I may need to modify. It was built in Frontpage.

I'm not familiar with FP. There's a block of code the top like this:

<SCRIPT type="text/javascript"><!--
document.write(unescape("%3C%53%43%52%49%50%54%20%74%79%70%65%3D%22%74%65%78%74%2F%6A%61%76%61%73%63%72%69%70%74%22%3E%3C%21%2D%2D%0D%0A%69%66%28%6E%61%76%69%67%61%74%6F%72%2E%75%73%65%72%41%67%65%6E%74%2E%69%6E%64%65%78%4F%66%28%22%4F%70%65%72%61%22%29%21%3D%2
etc etc etc
64%6F%77%2E%6F%6E%6D%6F%75%73%65%64%6F%77%6E%3D%6E%72%63%3B%66%75%6E%63%74%69%6F%6E%20%6F%6E%65%28%29%7B%72%65%74%75%72%6E%20%74%72%75%65%7D%6F%6E%65%72%72%6F%72%3D%6F%6E%65%3B%2F%2F%2D%2D%3E%3C%2F%53%43%52%49%50%54%3E"));//--></SCRIPT>


What is this block for/doing?
 
Technology news on Phys.org
  • #2
http://scriptasylum.com/tutorials/encdec/encode-decode.html"

This page will explain what is being done, although I'm not quite sure exactly what its "escaping" for your particular site. I'm sure you could find out though.

It turns out to be something like...

<SCRIPT type="text/javascript"><!--
if(navigator.userAgent.indexOf("Opera")!=. Î dow.onmousedown=nrc;function one(){return true}onerror=one;//--></SCRIPT>
 
Last edited by a moderator:
  • #3
OK, thanks.

So that code does a couple of things:
1] it's a browser sniffer
2] it defeats right-clicking

Not really sure why these are hidden, but I think it's a built-in FP feature.
 
  • #4
You use escape to URL-Encode a string and unescape for the reverse operation. It's the first time I've seen it used to "hide" code. It's an interesting strategy.
 

1. What is a code block in Frontpage JavaScript?

A code block in Frontpage JavaScript is a section of code that is enclosed within curly braces { }. It is used to group together multiple statements and is often used to create functions or conditional statements.

2. How do I add a code block in Frontpage JavaScript?

To add a code block in Frontpage JavaScript, you can simply use the opening and closing curly braces { } before and after the desired code. You can also use the "Code Block" option in the "Insert" menu to add a code block in the Frontpage editor.

3. What is the purpose of a code block in Frontpage JavaScript?

The purpose of a code block in Frontpage JavaScript is to group together multiple statements and organize your code. This makes it easier to read, debug, and maintain your code. Code blocks are also essential for creating functions and conditional statements.

4. Can I have nested code blocks in Frontpage JavaScript?

Yes, you can have nested code blocks in Frontpage JavaScript. This means that you can have a code block within another code block. However, it is recommended to keep your code blocks at a reasonable level of nesting to avoid confusion and maintain readability.

5. Is there a limit to the number of statements in a code block in Frontpage JavaScript?

No, there is no specific limit to the number of statements in a code block in Frontpage JavaScript. However, it is best practice to keep your code blocks concise and focused on a specific task. If your code block becomes too long, it may be a good idea to break it into smaller code blocks or create a separate function.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
2
Replies
36
Views
2K
Replies
3
Views
2K
  • Computing and Technology
Replies
1
Views
3K
  • General Discussion
Replies
18
Views
11K
  • Programming and Computer Science
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • Programming and Computer Science
Replies
5
Views
3K
Back
Top