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 14 of 14
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    popup access denied document.write

    l.s.

    when i try to popup a window (see script bellow) in get a message saying that access is denied, i tried everything (perhaps i missed one) but it comes back every time. perhaps there is someone who can help me??

    script:
    <html>

    <head>

    <script type="text/javascript">
    // Niks veranderen aan de HEAD-tag
    <!-- Begin
    function PrevFoto(img){
    foto1= new Image();
    foto1.src=(img);
    Controle(img);
    }
    function Controle(img){
    if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
    }
    else{
    functie="Controle('"+img+"')";
    interval=setTimeout(functie,20);
    }
    }
    function viewFoto(img){
    breed=foto1.width + 20;
    hoog=foto1.height + 20;
    string="width=" + breed + ",height=" + hoog;
    venster=window.open(img,"",string);
    venster.document.write('<html><body topmargin=0 leftmargin=0>');
    document.write('<img src=" ' & img & '" alt="leo met slang">');
    document.write('</body></html>');
    document.open()
    //Deze code gebruiken om geen randen rond de afbeelding te krijgen anders weglaten
    }
    // End -->
    </script>

    </head>



    <body>

    <A HREF="javascript:PrevFoto('C:/Documents and Settings/Leo/My Documents/Mijn webs/mijnweb214/images/huisdieren/IMG_1950.JPG')" > <IMG SRC='C:/Documents and Settings/Leo/Desktop/web tools/images/smile.gif' BORDER='0'></A>


    </body>

    </html>

  • #2
    New Coder
    Join Date
    Jun 2005
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure really, presumably cross site scripting is not occuring, here... look at you doc write line you have & instead of + ???

  • #3
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i tried that already , but the error access denied starts at the first at the first venster.document.write. i also tried to get my security down to the lowest level, but what ever i tried ...... no success. the window popup does show as soon as i remove "venster".

  • #4
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Try this:

    Code:
    <script type="text/javascript">
    // Niks veranderen aan de HEAD-tag
    <!-- Begin
    function PrevFoto(img){
    foto1= new Image();
    foto1.src=(img);
    Controle(img);
    }
    function Controle(img){
    if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
    }
    else{
    functie="Controle('"+img+"')";
    interval=setTimeout(functie,20);
    }
    }
    function viewFoto(img){
    var venster=window.open("","","width=" + (foto1.width + 20) + ",height=" + (foto1.height + 20));
    venster.document.open();
    venster.document.write('<html><body topmargin=0 leftmargin=0>');
    venster.document.write('<img src="' + img + '" alt="leo met slang">');
    venster.document.write('</body></html>');
    venster.document.close();
    //Deze code gebruiken om geen randen rond de afbeelding te krijgen anders weglaten
    }
    // End -->
    </script>
    hope this helps

    m_n
    Last edited by martin_narg; 06-05-2005 at 12:23 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #5
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the effort, but this script also gives the same error 'access denied'
    on the first statement: venster.document.open

  • #6
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    I used this script with no errors in IE or Firefox:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    function viewFoto(img){
    	var foto1 = document.getElementById("foto1").style;
    	
    	var venster = window.open("","","height="+(foto1.width + 20)+",width="+(foto1.height + 20));
    	venster.document.open();
    	venster.document.write('<html><body topmargin=0 leftmargin=0>');
    	venster.document.write('<img src=" ' + img + '" alt="leo met slang">');
    	venster.document.write('</body></html>');
    	venster.document.close();
    //Deze code gebruiken om geen randen rond de afbeelding te krijgen anders weglaten
    }
    </script>
    <title>Untitled Document</title>
    </head>
    
    <body><a href="#" onclick="viewFoto('myGif.gif');">launch window</a>
    <div id="foto1" style="width: 200px; height: 200px;">&nbsp;</div>
    </body>
    </html>
    Please note the declaring of the variables and using + instead of & as a string concatenator.

    Hope this helps.

    m_n
    Last edited by martin_narg; 06-05-2005 at 02:16 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #7
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    martin,

    it is driving me mad, this source also gives me an "access denied" error. might it be something to do with a security item?


    Leo

  • #8
    Regular Coder
    Join Date
    May 2005
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by leocoding
    thanks for the effort, but this script also gives the same error 'access denied'
    on the first statement: venster.document.open
    This is a local file, so your internet security settings are probably disallowing access to it...
    Last edited by enumerator; 06-05-2005 at 12:50 PM. Reason: took the last comment back ;)
    Thanks in advance!

  • #9
    Regular Coder
    Join Date
    May 2005
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by leocoding
    it is driving me mad, this source also gives me an "access denied" error. might it be something to do with a security item?
    info linked here: SP2, popups, help :)
    Thanks in advance!

  • #10
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry,

    but even this is not giving a solution, i hope to hear more,

    leo

  • #11
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    These URL's
    Code:
    'C:/Documents and Settings/Leo/My Documents/Mijn webs/mijnweb214/images/huisdieren/IMG_1950.JPG'
    'C:/Documents and Settings/Leo/Desktop/web tools/images/smile.gif'
    shouldn't they be
    Code:
    'C:\Documents and Settings\Leo\My Documents\Mijn webs\mijnweb214\images\huisdieren\IMG_1950.JPG'
    'C:\Documents and Settings\Leo\Desktop\web tools\images\smile.gif'
    /Bob
    Last edited by rwedge; 06-05-2005 at 07:58 PM. Reason: update

  • #12
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    changing the slash to backslash does not do the trick

  • #13
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, we go on,
    in htmlkit this works:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitledhead></title>

    <script language="JavaScript">
    <!--
    //
    function Foto(img){
    foto1= new Image();
    foto1.src=(img);
    CheckFoto(img);
    }
    function CheckFoto(img){
    if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
    }
    else{
    uitvoering="CheckFoto('"+img+"')";
    interval=setTimeout(uitvoering,20);
    }
    }
    function viewFoto(img){
    imgbreedte=foto1.width;
    imghoogte=foto1.height;
    vars="width="+imgbreedte+",height="+imghoogte+",left="+((screen.width-imgbreedte)/2)+",top="+((screen.height-imghoogte)/2);
    newwindow=window.open("","proximedia",vars);
    newwindow.document.write("<html>\n<head>\n<title>"+img+"</title>\n");
    newwindow.document.write("<meta http-equiv=\"imagetoolbar\" content=\"no\">\n");
    newwindow.document.write("</head>\n\n<body style=\"margin: 0 0 0 0;\">\n");
    newwindow.document.write("<img src=\""+img+"\" border=\"0\" onclick=\"javascript:window.close()\">\n");
    newwindow.document.write("</body>\n</html>\n");
    newwindow.document.focus();
    newwindow.document.close();
    }
    // einde script -->
    </script>


    </head>
    <body>
    <a href="javascript:Foto('C:/Documents and Settings/Leo/Desktop/test html/864-skull2.gif')"><img src="C:/Documents and Settings/Leo/Desktop/test html/smile.gif" border="0" ></a>

    </body>
    </html>


    but in frontpage the same problem: access denied!!!! anybody an idee why???

  • #14
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    Look at the URLs in your browser address bar. NO windows OS uses forward slashes in it's directory structure.

    The script works and is not something to be fixed. What doesn't work is wrong paths and evidently Frontpage, which is not a javascript problem nor a good method of publishing web pages.

    /Bob


  •  

    Posting Permissions

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