Starting Browser (Firefox, Safari, Opera, Chrome) from Batch/Bash Script

Last week i got a project to develop a small HTML5 web pages as that behave like a powerpoint slide. This web application is going to act like a flash replacement. So the user must be able to run this web app with a double click on the file. One way to accomplish that task is by using command line script either in mac or windows.
We’re going to use bat file in Windows to do this task.
File : [windows]autostart_browser.bat
@ECHO OFF START CHROME.EXE %~dp0index.html
In Mac we’re going to use a command file :
File : [mac]browser_autostart.command
#!/bin/bash # Opening Safari cd `dirname $0` open -a /Applications/Chrome.app file://$PWD/index.html
Replace Chrome with your prefered browser and index.html with your desired file. Remember that your HTML file must be in the same folder with the script file.
This setup allows users on both Windows and Mac platforms to launch your HTML5 presentation with ease, mimicking the user experience of opening a PowerPoint file.

todi
Berangkat dari pengalaman praktik nyata selama lebih dari 5 tahun di industri e-commerce, fokus utama saat ini adalah memadukan pengembangan WordPress dan optimasi WooCommerce ke dalam strategi digital yang nyata. Seluruh tulisan yang dihasilkan merupakan hasil dari pengujian langsung di lapangan, bukan sekadar teori. Memiliki misi untuk menyederhanakan teknologi web yang kompleks menjadi solusi yang teruji, memastikan setiap panduan teknis yang dibagikan dapat memberikan dampak nyata bagi performa bisnis dan efisiensi sistem.


Lets Work Together!
Create your ideal website with us.