Link to home
Start Free TrialLog in
Avatar of vanfleet
vanfleet

asked on

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
Avatar of JoaTex
JoaTex

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
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)
ASKER CERTIFIED SOLUTION
Avatar of spacepleb
spacepleb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vanfleet

ASKER

Spacepleb, your suggestion worked perfectly for both Netscape and IE. Sorry it took me so long to get back to you.

Thanks,

vanfleet