Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

Adding and removing scrollbars on a frame with NS


I need to be able to dynamically add and remove scrollbars from an html frame. I have this working fine in IE using:

  document.body.scroll="yes | no";  

But I can't get it to work in Netscape. The documentation says that I can use:

  scrollbars.visible=true | false;

However, to make it work I have to enable the  UniversalBrowserWrite privilege in Netscape. I'm not sure how to do this (and I'm not sure if I want to do this!).

Is there any easier way to do this?

Thanks,

dv
0
vanfleet
Asked:
vanfleet
1 Solution
 
JoaTexCommented:
Hi I'm not quite sure in Netscape but try This and tell me about:

<IFRAME SRC="Teste.html" NAME="myIframe" WIDTH="400" HEIGHT="200" SCROLLING="No"></IFRAME>
Jo
0
 
gator4lifeCommented:
I found this in some reference material:

As with Java signed objects, signed scripts use calls to Netscape's Java security classes to request expanded privileges. The Java classes are explained in Java Capabilities API.

In the simplest case, you add one line of code asking permission to access a particular target representing the resource you want to access. (See "Targets" on page 226 for more information.) For example:

netscape.security.PrivilegeManager.enablePrivilege("UniversalSendMail")
When the script calls this function, the signature is verified, and if the signature is valid, expanded privileges can be granted. If necessary, a dialog box displays information about the application's author, and gives the user the option to grant or deny expanded privileges.

Privileges are granted only in the scope of the requesting function and only after the request has been granted in that function. This scope includes any functions called by the requesting function. When the script leaves the requesting function, privileges no longer apply.

The following example demonstrates this by printing this text:

7: disabled5: disabled2: disabled3: enabled1: enabled4: enabled6: disabled8: disabled
Function g requests expanded privileges, and only the commands and functions called after the request and within function g are granted privileges.

<SCRIPT ARCHIVE="ckHistory.jar" ID="a">
function printEnabled(i) {   if (history[0] == "") {      document.write(i + ": disabled<BR>");   } else {      document.write(i + ": enabled<BR>");    }}
function f() {   printEnabled(1); }
function g() {   printEnabled(2);   netscape.security.PrivilegeManager.enablePrivilege(      "UniversalBrowserRead");   printEnabled(3);   f();   printEnabled(4); }
function h() {   printEnabled(5);   g();    printEnabled(6); }
printEnabled(7); h(); printEnabled(8);
</SCRIPT>
Targets
The types of information you can access are called targets. These are listed in the following table.

Target  Description  
UniversalBrowserRead
 Allows reading of privileged data from the browser. This allows the script to pass the same origin check for any document.
 
UniversalBrowserWrite
 Allows modification of privileged data in a browser. This allows the script to pass the same origin check for any document.
 
UniversalBrowserAccess
 Allows both reading and modification of privileged data from the browser. This allows the script to pass the same origin check for any document.
 
UniversalFileRead
 Allows a script to read any files stored on hard disks or other storage media connected to your computer.
 
UniversalPreferencesRead
 Allows the script to read preferences using the navigator.preference method.
 
UniversalPreferencesWrite
 Allows the script to set preferences using the navigator.preference method.
 
UniversalSendMail
 Allows the program to send mail in the user's name.
 
JavaScript Features Requiring Privileges
This section lists the JavaScript features that require expanded privileges and the target used to access each feature. Unsigned scripts cannot use any of these features, unless the end user has enabled codebase principals.


Setting a file upload widget requires UniversalFileRead.

Submitting a form to a mailto: or news: URL requires UniversalSendMail.

Using an about: URL other than about:blank requires UniversalBrowserRead.

event object: Setting any property requires UniversalBrowserWrite.

DragDrop event: Getting the value of the data property requires UniversalBrowserRead.

history object: Getting the value of any property requires UniversalBrowserRead.

navigator object:

Getting the value of a preference using the preference method requires UniversalPreferencesRead.

Setting the value of a preference using the preference method requires UniversalPreferencesWrite.

window object: Allow of the following operations require UniversalBrowserWrite.

Adding or removing the directory bar, location bar, menu bar, personal bar, scroll bar, status bar, or toolbar.

Hope this helps!

gator4life
(chomp, chomp)
0
 
spaceplebCommented:
You may find the overflow style declaration useful:

<style type="text/css">
<!--
body {overflow: hidden}
-->
</style>

You should then be able to access this via the DOM.
0
 
vanfleetAuthor Commented:
Spacepleb, your suggestion worked perfectly for both Netscape and IE. Sorry it took me so long to get back to you.

Thanks,

vanfleet

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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