Field work does not always happen where a reliable network connection is available. In this tutorial, we will modify a PHPRunner master-detail Add page so users can continue entering inspections after the connection is lost.
The loaded page stores the inspection, its detail records, and selected photos in the browser. When the application server becomes available again, the queued submissions are synchronized automatically.
This is not a fully offline application. The user must open the Add page while connected and keep that page open. Once it is loaded, the form can continue working without access to the server.
1. Preparing the inspection form
Create the following MySQL tables and add them to the PHPRunner project:
Create a master-detail relationship between inspections.inspection_id and findings.inspection_id.
Open the inspections Add page in Page Designer and add a Findings details preview. The Findings List page must allow Inline Add because each finding is entered as a detail row on the inspection form.
Configure the Findings fields as follows:
- room: Lookup Wizard with a static list such as Kitchen, Bathroom, Basement, Garage, and Other.
- description: Text area.
- photos: Document upload, with File-based Image as its View format.
A static lookup works after the connection is lost because its values are already included in the loaded page. An AJAX lookup would need to contact the server.
2. Adding the server availability check
Open Editor – Custom files, create offline_ping.php, and add the following code:
The browser’s online status does not guarantee that the application server is reachable. This file provides a small application-specific response that the synchronization code can verify. The request uses a four-second timeout and disables caching.
3. Saving submissions in IndexedDB
IndexedDB is a database built into modern web browsers. localStorage is useful for small text values, but IndexedDB can store structured records and binary objects such as the photos selected on this form. Its storage allowance is also generally much larger, although the exact limit is controlled by the browser and device.
Open Events – Global events – custom_functions.js and add the following JavaScript:
Download custom_functions.js.
The queue uses a generated ID for each submission and stores records under the home-inspection:demo scope. Change this scope consistently in both the JavaScript and offline_ping.php when adapting the example to another application.
The runtime listens for the browser’s online and focus events. It also checks the server every 30 seconds as a fallback. Browser locks prevent two tabs from draining the same queue simultaneously.
4. Intercepting the Inspections Add page
Open the inspections Add page – JavaScript OnLoad event and add this code:
Download the JavaScript OnLoad event code.
PHPRunner normally uploads a selected file immediately. The event intercepts file selection and drag-and-drop before that request begins, keeps the File objects in the browser, and generates local previews with URL.createObjectURL().
The event also intercepts the page’s normal Save operation. It validates the master fields and visible finding rows, adds the complete submission to IndexedDB, and then clears the form without reloading the page.
5. Synchronizing queued inspections
When the server responds to offline_ping.php, the project-level JavaScript reproduces the required PHPRunner save sequence:
- Create the inspection through the generated inspections_add.php page.
- Read the new inspection key returned by PHPRunner.
- For each finding, upload its photos through mfhandler.php.
- Create the finding through findings_add.php using that inspection key.
- Delete the IndexedDB entry only after all responses have been confirmed.
The synchronization checkpoint records the inspection key and the next detail row to send. If a write may have reached the server but its response was not confirmed, the entry remains queued instead of blindly repeating the write and possibly creating a duplicate.
Status messages show whether submissions are waiting, being sent, successfully synchronized, or blocked by an error.
6. Testing the offline workflow
Build the project and open the Inspections Add page while connected to the server. In the browser’s developer tools, open the Network panel and select ‘Offline’.
Enter an inspection, add one or more finding rows, select photos, and click ‘Save’. The form should remain open and display a message that the inspection was saved on the device.
To inspect the queue in Chrome or Edge, open Developer tools – Application – IndexedDB – phprunner-offline-add-v1 – submissions.
Add another inspection if required, then clear the Network panel’s ‘Offline’ setting. The application should begin synchronization immediately. If the browser’s online event does not fire, the next 30-second server check will start it.
Open the Inspections List page and confirm that the master records, finding rows, and uploaded photos were saved.
7. Current scope and possible next steps
The Add page must be loaded before the connection is lost. Do not reload or close it while offline. IndexedDB data belongs to the current browser profile and device, so opening the application in another browser will not expose the same queue.
This approach can be extended in several ways. A Progressive Web App and service worker could allow the page itself to open offline. Lookup-table data could be cached in IndexedDB and refreshed while connected. Applications that require login could detect an expired session, ask the user to sign in again, and resume synchronization afterward. A dedicated REST API could also replace the generated-page requests when a more formal synchronization interface is required.
PakarPBN
A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.
In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.
The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.
Comments are closed, but trackbacks and pingbacks are open.