[WebBrowser1Addr]
[WebBrowser1Title]
But if you want to display page description, keywords and a featured image with that (like Facebook and Twitter do!) here is the JavaScript:
Code: Select all
<script type="text/javascript">
function getMetaData(){
var TheDescription = document.getElementsByName('description')[0].getAttribute('content');
alert(TheDescription);
var TheKeywords = document.getElementsByName('keywords')[0].getAttribute('content');
alert(TheKeywords);
var TheImage = document.querySelectorAll("meta[property='og:image']")[0].content;
alert(TheImage);
// (OR)
var TheImage = document.querySelector("meta[property='og:image']").content;
alert(TheImage);
};
</script>
[syntax=neobook]BrowserExecScript "WebBrowser1" "window.external.nbSetVar('TheDescription',document.getElementsByName('description')[0].getAttribute('content'));" "JScript"
BrowserExecScript "WebBrowser1" "window.external.nbSetVar('TheKeywords',document.getElementsByName('keywords')[0].getAttribute('content'));" "JScript"
BrowserExecScript "WebBrowser1" "window.external.nbSetVar('TheImage',document.querySelectorAll([#34]meta[property='og:image'][#34])[0].content);" "JScript"
.(OR)
BrowserExecScript "WebBrowser1" "window.external.nbSetVar('TheImage',document.querySelector([#34]meta[property='og:image'][#34]).content;" "JScript"
[/syntax]
I found that getting the featured image is tricky because some sites don't name it "og:image" while other sites don't even have a featured image in their metadata content at all. That can sometimes make the Neobook program search a page for too long until it becomes unstable. If anyone has a workaround for this I would greatly appreciate it....
UPDATE: To use the above Neobook Actions please correct [0] with [#91]0[#93]
Then everything will work just fine.... I went down a blind alley in the examples below but it was fun!
.