Check if the browser is Safari and the page is the home page and the session is not running. If yes, then redirect the top url of the window to the original iframe url.
Steps to fix the Laravel marker mismatch error when using iframes in Safari using redirection:
1) Add route
Route::get('/start-session', ' HomeController@startSession ');
2) Add controller action
public function startSession() { session()->put('isSessionStarted', true); return redirect('http://www.iframeparentsite.com');
3) Install the jenssegers/agent module to discover the Safari browser https://github.com/jenssegers/agent
composer require jenssegers/agent
4) Use it in the controller
use Jenssegers\Agent\Agent;
5) Go isSafari , isHomepage and isSessionStarted to view the action on the main page.
public function index() { $agent = new Agent(); $this->data['isSafari'] = $agent->is('Safari') && !$agent->is('Chrome'); $this->data['isHomepage'] = true; $this->data['isSessionStarted'] = session()->get('isSessionStarted'); return view('home', $this->data); }
6) Add blade / javascript code in page layout section
@if ($isSafari && !empty($isHomepage) && empty($isSessionStarted)) window.top.location = "{{ url('/start-session') }}"; @endif
Redirection will occur once on the main page and will take 1/2 second
Manoj yadav
source share