I try to create plugin ini hapi.js framework, I register my plugin and try to get URL every time user change the page.
Example: I open http://example.com
will get http://example.com
or http://example.com/about
will get http://example.com/about
.
This is my code I have try.
Plugin:
exports.plugin = {
name: 'dlAcl',
pkg: require(__basedir + '/package.json'),
register: async (server, options, next) => {
server.ext('onPostAuth', (request, replay) => {
console.log('### ' + request.url);
return replay.continue;
});
},
};
With this code I got the URL but not only the URL address, all request like .css and .js request show too like this.
http://example.com/
http://example.com/bootstrap/dist/css/bootstrap.min.css
http://example.com/datatables.net-bs4/css/dataTables.bootstrap4.min.css
http://example.com/multiselect/css/multi-select.css
http://example.com/tinymce/tinymce.min.js
http://example.com/scripts/global.js
How if I just want get http://example.com/
?
Thanks for advance.
question from:
https://stackoverflow.com/questions/65858192/hot-to-get-url-every-change-the-page 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…