Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    avoiding IE security warning when using javascript

    I am trying to do a simple version of something that I saw on Foxton's website:

    http://newyork.foxtons.com/search?s...cation_ids=3004

    (from the map, if you click on Queens, it causes a list of neighborhoods to appear)

    I tested that, and it works in IE, Mozz and Firefox.

    So, I tried to make a simplified version that would perform the same task, but when I test it in IE, I recieve a warning in the toolbar that says, "To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options..."

    my simple version only uses javascript (as does Foxton's site), but the Foxton site does not generate that same warning.

    What gives ???

    Here is my dopey code, just so you can see what IE is barking about.
    I have already provided a link to Foxton's site (above). No barks from IE on that one.

    I would just like to accomplish this very simple task without causing IE any undue stress.
    Any help would be appreciated.


    <HTML>
    <HEAD>

    <script language ="javascript">

    function d1()
    {
    document.all.div1.style.display = 'block';
    document.all.div2.style.display = 'none';
    document.all.div3.style.display = 'none';
    }

    function d2()
    {
    document.all.div1.style.display = 'none';
    document.all.div2.style.display = 'block';
    document.all.div3.style.display = 'none';
    }

    function d3()
    {
    document.all.div1.style.display = 'none';
    document.all.div2.style.display = 'none';
    document.all.div3.style.display = 'block';
    }

    </script>

    </HEAD>

    <BODY>
    <div style="position:absolute; left:200px; top:50px;">
    <div id="div1" STYLE="display: none">DIV 1 text</div>
    <div id="div2" STYLE="display: none">DIV 2 text</div>
    <div id="div3" STYLE="display: none">DIV 3 text</div>
    </div>

    <div style="position:absolute; left:300px; top:300px;">
    <input type="radio" name="r1" onClick="d1();">
    <input type="radio" name="r1" onClick="d2();">
    <input type="radio" name="r1" onClick="d3();">
    </div>

    </body>
    </HTML>
    Last edited by devildog; 01-26-2006 at 10:35 PM. Reason: (spelling)

  • #2
    Regular Coder
    Join Date
    Jul 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    IE complains when you open an HTML file that contains JavaScript on your local machine.

    It won't complain if the same file is actually on a web server.

  • #3
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    881
    Thanks
    0
    Thanked 115 Times in 114 Posts
    it is because you havent activated "active scripting" in IE's zone-settings for local pages while it is allowed for internet-pages

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,032
    Thanks
    0
    Thanked 248 Times in 245 Posts
    The security prompt appears in IE6 on XP SP2 by default as a security measure when running local html files. You can change the settings of course but for your protection it's not recommended to do so, that's why MS sets it like that by default. And as Mongus said, it will not appear when the page is run from a Web server whether on Intranet or Internet.

    There's also a feature in IE called Mark of the Web (MOTW).

    <!-- saved from url=(0022)http://www.google.com/ -->

    It forces Web page to run under the security zone of the location specified in MOTW. If the location is an internet URL, the local page is run in Internet zone where that security prompt is disabled by default. So if your local html file contains the above MOTW at the top of the page after DOCTYPE declaration, the prompt will not appear and the script will run as if it's run from a web server.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •