Search code examples
laravelassetslaravel-3

Laravel 3.x Assets: how to include an external url


I'm trying to include a google CDN jquery link into the Laravel Assets container but the link is being concatenated to my site address, like this:

<script src="http://mybeautifulsite.com/<script src=" http:="" ajax.googleapis.com="" ajax="" libs="" jquery="" 1.8.3="" jquery.min.js"=""></script>

Is there any way to include external links into the assets container?

EDIT

Here's the code I'm using to include the asset:

Asset::add('jquery', '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>');

Solution

  • Should just be:

    Asset::add('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');
    

    Whilst the documentation does not explicitly talk about absolute URLs, the code is written in such a way to handle them.