I have an MVC4 application where I render a View but most of the content is generated dynamically with javascript after I pass a parameter. I would like to know how I could either save all this html generated via javascript into a string (being able to use it in my controller) or save the html page as file.
我有一个MVC4应用程序,我在其中呈现一个视图,但大多数内容是在我传递参数后使用javascript动态生成的。我想知道如何将通过javascript生成的所有html保存到字符串中(能够在我的控制器中使用它)或将html页面保存为文件。
1 个解决方案
#1
0
it is not clear what is your process but you can do it at least two ways:
目前尚不清楚您的流程是什么,但至少可以通过两种方式实现:
-
you can get rendered html markup using javascript document.documentElement.outerHTML after document loaded, may be execute ajax call to post it to another action if that is what you trying to do.
您可以在加载文档后使用javascript document.documentElement.outerHTML获取呈现的html标记,可以执行ajax调用将其发布到另一个操作,如果这是您要执行的操作。
-
from Chrome/FF, hit f12 and go to Elements/Inspector tab, then righ click on parent html node then on "Edit As HTML", it will show rendered html in textbox, you can copy it.
从Chrome / FF,点击f12并转到Elements / Inspector选项卡,然后右键单击父html节点,然后在“编辑为HTML”,它将在文本框中显示渲染的html,你可以复制它。
hope it helps.
希望能帮助到你。
#1
0
it is not clear what is your process but you can do it at least two ways:
目前尚不清楚您的流程是什么,但至少可以通过两种方式实现:
-
you can get rendered html markup using javascript document.documentElement.outerHTML after document loaded, may be execute ajax call to post it to another action if that is what you trying to do.
您可以在加载文档后使用javascript document.documentElement.outerHTML获取呈现的html标记,可以执行ajax调用将其发布到另一个操作,如果这是您要执行的操作。
-
from Chrome/FF, hit f12 and go to Elements/Inspector tab, then righ click on parent html node then on "Edit As HTML", it will show rendered html in textbox, you can copy it.
从Chrome / FF,点击f12并转到Elements / Inspector选项卡,然后右键单击父html节点,然后在“编辑为HTML”,它将在文本框中显示渲染的html,你可以复制它。
hope it helps.
希望能帮助到你。