1

I'm trying to access 2 external CSS files and one JS(jQuery) file. I'm adding them to my site like this:

<link rel="stylesheet" href="http://www.externalsite.com/css/style.css" type="text/css" />

and

<script src="http://www.externalsite.com/js/jquery.easing.1.3.js"></script>
<script src="http://www.externalsite.com/js/default.js"></script>

Within default.js, there is a bit of jQuery that control the drop down of my menu. The drop downs don't appear. The HTML code is correct when I view the source.

Am I linking tot he files correctly? Any ideas why I'm not seeing my drop downs?

EDIT:

I'm linking to a HTTP site from a HTTPS site, if that matters.

EDIT 2:

JSFiddle added: http://jsfiddle.net/tvZUG/

16
  • have you tested the code locally without https? Commented Apr 20, 2012 at 18:22
  • You are linking the files correctly. Are you sure the external site isn't blocking you from hotlinking their files? Commented Apr 20, 2012 at 18:22
  • @Raminson - Yes, still won't work Commented Apr 20, 2012 at 18:23
  • @KevinB - No, I own both sites. Nothing is blocked. Commented Apr 20, 2012 at 18:23
  • 1
    Use Firebug or Chrome Developer tools to see if the css and js are being loaded by the browser. For example, in firebug, you would enable js in the "Script" tab, and then try to select the 'default.js' and jquery. If you see them on the list and can view their content from within firebug, they are correctly linked and the problem is elsewhere (perhaps with your DOM selector). Commented Apr 20, 2012 at 18:30

4 Answers 4

3

I'm linking to a HTTP site from a HTTPS site, if that matters.

Yes it matters. A secure page needs secure resources.

If external site supports https you can get it without defining protocol:

<script type="text/javascript" src="//www.externalsite.com/js/default.js"></script>

And there's a similar question. Also take a look at it.

Sign up to request clarification or add additional context in comments.

Comments

1

Try adding a type to your script, something like this.

<script type="javascript/text" src="http://www.externalsite.com/js/default.js"></script>

Are you having any troubles with your css ?

3 Comments

I'll give it a shot. No, CSS loads fine
do you have the jquery library set up? if not add <script type="javascript/text" src="http://code.jquery.com/jquery-1.7.2.min.js"> before all your js files. I would recommend finding your problem with chrome inspector or something.
hmmm it sounds like you're importing the file correctly, any chance it's the js file that's causing you problems?
1

Maybe you have forgot to import jQuery? I can only see the code for the plugin...

4 Comments

Sorry, jQuery is there, just didn't show it in the sample above. Thanks
Well I can see the menu. The only problem is that it disappears when you leave the label "Menu 1". Which browser do you use?
Yep, that's what's confusing me. I'm testing on IE, Chrome and FF
It's true, its kinda weird. This is the best solution I could make: jsfiddle.net/GhpgN
1

i think problem can be https that maybe does not allow you to execute javascript files from external sources, you can store files on your server and call them instead.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.