Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with Atrakeur's answer chosen by CommunityBot
Notice added Draw attention by kramer65
Bounty Started worth 150 reputation by kramer65
added 165 characters in body
Source Link
kramer65
  • 54.5k
  • 133
  • 333
  • 533

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any laravel build-in solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

[EDIT]

I know that Laravel normally detects the protocol correctly, but when behind a load balancer, it does not. So I'm still looking for a solution to this.

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any laravel build-in solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any laravel build-in solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

[EDIT]

I know that Laravel normally detects the protocol correctly, but when behind a load balancer, it does not. So I'm still looking for a solution to this.

added 17 characters in body
Source Link
Chen-Tsu Lin
  • 23.3k
  • 16
  • 57
  • 65

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any laravel build-in solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any laravel build-in solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?

Source Link
Chen-Tsu Lin
  • 23.3k
  • 16
  • 57
  • 65

Laravel: Set asset without protocol

Use asset helper function like below:

<script src="{{ asset('/assets/js/jquery-2.1.1.min.js') }}"></script> 

will get

<script src="http://xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

Is there any solutions can let it be

<script src="//xxx.xxx.com/assets/js/jquery-2.1.1.min.js"></script> 

and properly display with http and https protocols?