whilst programming for HTML I stumbled on manifest.json files, for native Chrome/Android applications, but I can not load the manifest, situated at: "/manifest.json"; I used this jQuery code to add the link to the head tag.
$('head').append('<link rel="manifest" href="/manifest.json">');
But it adds it to the head of the document, but it doesn't read the manifest; it just says: "No manifest found".
Can anyone help me with this???
you have to run the jQuery command before DOM ready
Like this
Type 1:
$(window).load(function() {
$('head').append('<link rel="manifest" href="/manifest.json">');
})
Type 2: Use $.getJSON
$.getJSON( "ajax/test.json", function( data ) {
var items = [];
$.each( data, function( key, val ) {
items.push( "<li id='" + key + "'>" + val + "</li>" );
});
$( "<ul/>", {
"class": "my-new-list",
html: items.join( "" )
}).appendTo( "body" );
});
Script Loaded in jQuery :-
In this below example i didn't include bootstrap in html but i included in
$(window).load()
It works.
$(window).load(function(){ $('head').append('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">'); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <html> <head> </head> <body> <table class="table"> <thead> <tr> <th>Firstname</th> <th>Lastname</th> <th>Email</th> </tr> </thead> <tbody> <tr> <td>Mary</td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td>July</td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </body> </html>
No Script
<html> <head> </head> <body> <table class="table"> <thead> <tr> <th>Firstname</th> <th>Lastname</th> <th>Email</th> </tr> </thead> <tbody> <tr> <td>Mary</td> <td>Moe</td> <td>mary@example.com</td> </tr> <tr> <td>July</td> <td>Dooley</td> <td>july@example.com</td> </tr> </tbody> </table> </body> </html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.