session object

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

session object

Postby Otto » Mon Oct 07, 2019 6:38 am

Hello,
When I programmed with ASP we use the session object to swap data between the different web sides.What are the disadvantages of using the javascript session object instead of the post method.

Thank you in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6046
Joined: Fri Oct 07, 2005 7:07 pm

Re: session object

Postby Massimo Linossi » Mon Oct 07, 2019 7:26 am

Hi Otto.
I simulate the way PHP use sessions with a file. You can create a cookie with the name of the user and a string with the name of the file.
This file is a dbf placed in a folder with some columns a one row for every string you want to use and its value.
With some functions you can create a session, write it, read it, control if is alive and delete it if is a lot of time that is not used or closed
by a logout from the program.
There is some code to write but is working in the same way PHP does.
Massimo
User avatar
Massimo Linossi
 
Posts: 495
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: session object

Postby Otto » Mon Oct 07, 2019 8:11 am

Hello Massimo,
I am using javascript session object and this is working perfectly.
Only - as nobody seems to use it - I do not know if I will face problems with these objects.
Development is much easier as with the post method and also speed is better.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6046
Joined: Fri Oct 07, 2005 7:07 pm

Re: session object

Postby Otto » Mon Oct 07, 2019 8:40 am

Hello,
I found good documentation for this here:
https://javascript.info/localstorage

The limit is 2mb+, depends on the browser.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6046
Joined: Fri Oct 07, 2005 7:07 pm

Re: session object

Postby Otto » Mon Oct 07, 2019 4:50 pm

Hello,
session object is working perfectly.
Save Javascript objects in sessionStorage

https://stackoverflow.com/questions/619 ... ionstorage



calling web page:
Code: Select all  Expand view

   var name =  Object.create(null);
    name.FirstName= "Otto";
    name.LastName = "Mustermann"
    name.strasse="Bahnhofstrasse"
    name.Age ="25"

     sessionStorage.setItem('example', JSON.stringify(name));


request page

Code: Select all  Expand view
var temp = sessionStorage.getItem('example');
       
var viewName = $.parseJSON(temp);
var div = '<div>' + viewName.FirstName + ' ' + viewName.LastName + ' ' + viewName.strasse + ' is ' + viewName.Age + ' years old.' + '</div>';
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6046
Joined: Fri Oct 07, 2005 7:07 pm

Re: session object

Postby Otto » Thu Sep 09, 2021 6:31 am

Hello friends,
Does anyone know the disadvantages of using the session object for the CRUD methods (ADD, EDIT, DELETE) records instead of AJAX?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6046
Joined: Fri Oct 07, 2005 7:07 pm


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 3 guests