Get node path via javascript I am attempting to add history states to view items that are loaded using the infitine scroll module. On my first attempt, I am adding the following code to the infinite scroll.js file in the load section. I have partial success in using Drupal.settings.basePath variable, however, I would like to get the node that gets loaded as opposed to the baseurl. Is there a call in javascript for this? Here is my sample so far: 

var baseUrl = Drupal.settings.basePath;
history.pushState('', '', baseUrl);
You can add the node ID manually to Drupal settings with drupal_add_js(), for example from a preprocess function.

// PHP
$setting = array('setting_1' =&gt; 'value_1', 'setting_2' =&gt; 'value_2');
drupal_add_js($setting, 'setting');




// JavaScript
var nodeId = Drupal.settings.setting_1;