c# - Html 5 manifest is not working by iFrame correctly -


I have an application that has many C # projects, as follows

  • CRM.Demnologic
  • Warehouse.dominalogic
  • Warehouse. Web
  • , ...

Each web project like CRM.Web has its own 'html idea' and 'JS controller' There are many other types of stable files.

To make the deployment easier, I want to use the HTML5 Manifest.

So, to do different deployment in projects, I have used the iframes CRM. With the changes of the web, CRM files will be found, and there is no need to download the Warehouse web file again!

Step:

1- I have a web API method which returns all the names of web assemblies, for example CRM. Web & Warehouse Web

2- I have another Web API method that receives assembly names as a parameter and the manifest file content that indicates the files located on that project.

  Public HTTPPS message messages GetManifestByAssemblyName (string assembly)  

The codes are omitted here.

  response.Content = new StringContent (manifestBody.ToString (), encoding. UTF8, "text / cache-manifest"); 3- In the client side, I am creating a new iframe for each assembly and sets src on other web API method which returns to the HTML body that the manifest reveals the WebAPI method returns the string Results = string.form (@ "& lt; html manifest = '{0}' & gt; & lt; / html & gt;", Manifest Body ( GetManifestByAssemblyName )  
  "/ Api / AppManifest / GetManifestByAssemblyName? Assembly name =" + assembly name + ".manifest"); reaction. Content = new string content (result, UTF 8 encoding. Default, "text / html");  

Code of iFrames:

  var htmlPageUrl = "/ api / AppManifest / GetHtmlContainerForManifestByName? Assembly name =" + name; Var iFrame = document.createElement ("iframe"); IFrame.setAttribute ("src", htmlPageUrl); IFrame.setAttribute ("Sandbox", "Permission-Similar-Basic"); IFrame.setAttribute ("seamless", "seamless"); Document.body.appendChild (iFrame);  

When I run the application, it gets the assembly name, and then creates iFrames, and each iframe itself appears automatically.

But the window Apalicio.cache.status is 0 which means that there is no cache in it.

When I go to the resource page, I can follow the following:

But when I request one of those files that are cached, the request will not use the cache.

I know that there is no reference to my work on the web and it is completely based on my thoughts, and I know that some security restrictions can be shown here, but do anyone Is there a way to fix the problem?

Thanks in advance. / P>

Note:

Then press Ctrl + S to save the file, and first read Index.html notes.

I have tried your sample project. I had to convert the sandbox attribute to permission-script because otherwise Chrome was blocking JS performance from iframe.

Also, I think your cache is working fine See screenshot below image here Enter the details

I think the root of your confusion is that you are checking the status of the app cache of the main document, which clearly does not have the documents loaded in the manifest IFrame Is for. So in Chrome, if you switch to individual iframes and check status, then it displays useless (1) which means the cache is active! See below:

Enter image details here

Hope That it helps!


Comments