WebBrowser/Tools/Scripts.py

branch
QtWebEngine
changeset 4733
ae291a307ea6
parent 4731
67d861d9e492
child 4741
f9e1adc69076
--- a/WebBrowser/Tools/Scripts.py	Thu Feb 11 20:27:07 2016 +0100
+++ b/WebBrowser/Tools/Scripts.py	Fri Feb 12 19:12:03 2016 +0100
@@ -154,3 +154,27 @@
             return res;
         }})()"""
     return source.format(pos.x(), pos.y())
+
+
+def getAllMetaAttributes():
+    """
+    Function generating a script to extract all meta attributes of a web page.
+    
+    @return script to extract meta attributes
+    @rtype str
+    """
+    source = """
+        (function() {
+            var out = [];
+            var meta = document.getElementsByTagName('meta');
+            for (var i = 0; i < meta.length; ++i) {
+                var e = meta[i];
+                out.push({
+                    name: e.getAttribute('name'),
+                    content: e.getAttribute('content'),
+                    httpequiv: e.getAttribute('http-equiv')
+                });
+            }
+            return out;
+            })()"""
+    return source

eric ide

mercurial