简体   繁体   中英

Laravel 4 with HTML5 History

How can I utilize HTML5 history with Laravel 4? Here is my blade content file:

@extends('main')

@section('content')
   This is content.
@endsection

I was thinking to only load the content part in HTML5 history by putting:

@if($showMain)
@extends('main')
@endif

But it doesn't work. The @extends has to be the very first line of the file. I was thinking of putting a few @if($showMain) in the main file. But this way will make the code messy and less maintainable. So, how can I archive that with a cleaner way in Laravel blade? Or, is there a better way to do HTML5 history with Laravel?

Thanks.

History can only be accessed via client-side Javascript code, so there's no way to access that in Laravel which is run server-side.

What you can do though is keep track of the page history on the server's side using sessions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM