简体   繁体   English

C#VS2012在浏览器中的网页中放置/添加代码

[英]C# VS2012 place/add code into web pages in the browser

I want to know if you can, have a button that links to a web page like this 我想知道是否可以有一个链接到这样的网页的按钮

        System.Diagnostics.Process.Start("http://www.google.com");

except you can input your own code into the webpage. 除了您可以在网页中输入自己的代码。 much like you can go into the developer tools in chrome and add code. 就像您可以进入chrome开发人员工具并添加代码一样。 I want to add code to the header section of the page. 我想将代码添加到页面的标题部分。

either this or put changes to the values in input fields, so the values are what i want them to be. 要么对此进行更改,要么对输入字段中的值进行更改,所以这些值就是我想要的。

thanks for any help 谢谢你的帮助

Yes you can - use WebBrowser control in your form, navigate to page you like and after navigation is complete add whatever you want to the page. 是的,您可以-在表单中使用WebBrowser控件,导航到所需的页面,导航完成后,将所需的内容添加到页面中。

If you want to do that with just browser and java script on your page - it is not possible due to browser's same origin policy (script on one site can't access properties of pages on other sites). 如果您只想使用页面上的浏览器和Java脚本来执行此操作-由于浏览器的原始策略相同(一个网站上的脚本无法访问其他网站上的页面的属性),则不可能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM