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

    javascript working in Chrome, but no in other browsers

    Hi people, I have the followin code:
    <html>
    <head>
    <title>My Page</title>
    </head>
    <BODY>
    <script id=url language=javascript src=""></script>
    <script type="text/javascript">
    document.getElementById("url").src = "http://www.mysite.com/mypage.aspx";
    </script>
    </body>
    </html>


    This code is working fine with Chrome, but it doesn't for other browser (IE, Firefox, Opera)... I've not been able to find where the problem is... IE gives me an error: internet explorer could not open the website. Operation aborted. The other browsers don't show any message.
    Could you help me with this?
    Thanks,
    Last edited by nocuser; 03-11-2010 at 12:19 PM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You document needs a Doctype. Attributes values need double quoted. language is deprecated, use type="text/javascript" instead of language=javascript. You should rather use a function called onload. Finally, I don't see the point of your code.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks kor, this code is an example, my code is a bit more complex than it... but I wanted to put a simple code where everybody could see the problem.
    Anyway, the problem with IE is already happening...

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    but I wanted to put a simple code where everybody could see the problem.
    Then, please follow the instructions from Kor and repost your modified code, so that we can test in the specified browsers.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The modified code is:

    <script id="test" type="text/javascript"></script>

    <script type="text/javascript">
    document.getElementById("test").src = "http://www.mysite.com/mypage.aspx?&var1=value&var2=value2";

    </script>


    Mypage.aspx returns some code depending on the variables, that code may open another .aspx file for example.

    Now, the previous script is working for all the browsers, except IE...

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The error might not be in the way you are linking the script, but in the script itself. Could you post the generated script by that url?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The code returned is:

    Code:
    document.write("<SCRIPT> function openWindow(programa) 
    				{ var omenu = window.open(programa, \"\", \"width=500,height=500,left=20,top=20,scrollbars=no,menubar=no,toolbar=no,resizable=no,directories=no\"); 
    					omenu.focus(); }; 
    				</script>
    				<a href=javascript:openWindow(\"http://www.mysite.com/mypage.aspx?&var1=val1&var2=val2\")> 	
    					<img src=http://www.mysite.com/icons/image.png></a>")
    Thanks,
    Last edited by Kor; 03-12-2010 at 03:34 PM. Reason: wrap the code [code[/code], disable smilies and get rid of the colored text


  •  

    Tags for this Thread

    Posting Permissions

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