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

    Internet Explorer IE7 Won't load external JS

    I have a hide/show script in js which works fine in Firefox, but doesn't even show in Internet explorer. When I try to directly load the js file in Internet Explorer, I get an error

    "Internet Explorer cannot download collapse.js.php from courses.mytwu.ca.

    Internet Explorer was not able to open the Internet site. The requested site is either unavailable or cannot be found. please try again later."

    Here is the file: https://courses.mytwu.ca/my/collapse.js.php

    I'm currently using Firefox 3.0.1 and Internet Explorer 7.0.5730.11

    Does anybody know why this would happen?
    Last edited by davidkazuhiro; 10-04-2008 at 06:59 AM. Reason: Forgot to add a question

  • #2
    New Coder
    Join Date
    Feb 2005
    Posts
    97
    Thanks
    7
    Thanked 7 Times in 7 Posts
    Remove the .php suffix (which is for PHP files) and use only the .js suffix.

    i.e. rename the file to collapse.js

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's.php because it has php code in it which generates the javascript... So is ie7 not able to handle *.js.php filenames?

  • #4
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry IE doesn't like the js code itself

    I tried changing it to collapse.php, and it still didn't work in internet explorer. It still worked in firefox though.

    I tried changing it to collapse.js, and it didn't work in internet explorer that time either. In firefox, the show/hide function still worked but the php scripts didn't run so the images for the buttons didn't show up (since their uri's weren't generated by php).

    So Internet Explorer must not be liking something about the javascript itself. Can somebody read the code by clicking on the link in my first post, and see if they can spot anything suspicious?

  • #5
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    try embeding the code in the page with a valid image src or post the HTML the script uses
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #6
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Try setting the content type to text/plain and see if it makes a difference.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #7
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried changing the content type to text/plain. That just made it stop working in both browsers. I'll try embedding the code later when I have time and see what happens

  • #8
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    The use of php is a non-issue.
    It's being served up correctly as text/javascript, so it's not going to be the problem.

    I'd focus on the DOM methods used in the headercatid function.
    Try swapping out hasAttribute and getAttribute methods for older DOM0 methods.

    e.g.
    Code:
    function headercatid(header) {
    	if (!header.id) {return false;}
    	var id = header.id;
    	var m = id.match(/cat\-header\-(\d+)/);
    	if (m === null) {return false;}
    	return m[1];
    }
    Last edited by Bill Posters; 10-16-2008 at 08:17 AM.

  • #9
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Wow thanks Bill!

    I made your suggested changes the buttons appear in IE7 and they work! =). And they still work in Firefox.

    They are placed oddly though (bleeding of the edge of the h2 box so you can barely see them) but hopefully I'll be able to fix that with a little bit of CSS. Now my IE users will be happy too =P.

    So is it just that IE doesn't support hasAttribute and getAttribute yet?


  •  

    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
    •