Azure/C++/C#/Java/Asp.net/JavaScript/Html - MFC/COM/ActiveX/eclipse/Web

dlbrant

working soft

博客园 首页 新随笔 管理

随笔分类 -  Web

Web, asp.net, javascript, html, xml, ajax
摘要:js中调用console写日志console.log("some log");console.warn("some warning");console.error("some error");IE:只有在打开IE开发者工具后才能使用console,默认访问IE的console对象会出错。FF和Chrome没有问题。 阅读全文
posted @ 2013-06-20 18:27 dlbrant 阅读(5899) 评论(1) 推荐(0)

摘要:// BHO 中添加下面的函数,设置UIHandler// BHO 包含如下成员变量:// CDocDispatch m_docDispatch;// CComPtr<IDocHostUIHandler> m_spDefaultDocHostUIHandler;// CComPtr<IOleCommandTarget> m_spDefaultOleCommandTarget;HRESULT CBHO::SetDocHostUIHandler(IDispatch *pWebBrowser){ HRESULT hr = S_OK; if(NULL == pWebBrowse 阅读全文
posted @ 2013-06-18 19:08 dlbrant 阅读(3346) 评论(1) 推荐(0)

摘要:往一个空的iframe中写入内容,再其document ready之前有可能遇到拿回 的body指针为空,因此以下面的函数往其document中写入htmlHRESULT WriteToHtmlDocument(CComPtr<IHTMLDocument2> spDoc2, CComBSTR &bstrHtml){ HRESULT hr = S_OK; //BSTR bstr = SysAllocString(OLESTR("Written by IHTMLDocument2::write().")); BSTR bstr = bstrHtml.Copy 阅读全文
posted @ 2013-06-18 10:05 dlbrant 阅读(1477) 评论(0) 推荐(0)

摘要:获得iframe标签的元素指针CComPtr spAdIframe = ...CComQIPtr spFrameBase2 = spAdIframe;CComPtr spIframeWindow2 = NULL; hr = spFrameBase2->get_contentWindow(&spIframeWindow2);由此可得到iframe元素对应的IHTMLWindow2指针,然而如果直接使用IHTMLWindow2::get_document来获取IHTMLDocument2指针的话,经常得到的是E_ACCESSDENIED错误,因为iframe元素经常用于跨域的访问,即 阅读全文
posted @ 2013-06-18 09:57 dlbrant 阅读(2443) 评论(0) 推荐(0)

摘要:主要就是修改注册表键值使IE不创建多个进程:HKLM\Software\Microsoft\Internet Explorer\Main - TabProcGrowth但需要注意的是这种情况下,vs2008下debug会变卡,不知道神马原因。1. 调整IE tab process growth:修改注册表键值:HKLM\Software\Microsoft\Internet Explorer\Main - TabProcGrowth (string or dword)Tab Process Growth : Sets the rate at which IE creates New Tab p 阅读全文
posted @ 2013-06-17 12:05 dlbrant 阅读(502) 评论(0) 推荐(0)

摘要:js脚本是按其出现在文档中的顺序执行的。<script> tag的内容总是在被解析到的时候被js引擎解释,所以最后一个script tag总是当前正在解析的script tag, sample如下:<div><script> var scriptTag = document.getElementsByTagName('script'); scriptTag = scriptTag[scriptTag.length -1]; var parent = scriptTag.parentNode;</script></div> 阅读全文
posted @ 2013-06-13 17:23 dlbrant 阅读(156) 评论(0) 推荐(0)

摘要:调用IHTMLElement::insertAdjacentHTML插入HTMLvirtual /* [id] */ HRESULT STDMETHODCALLTYPE insertAdjacentHTML( /* [in] */ __RPC__in BSTR where, /* [in] */ __RPC__in BSTR html) = 0;可用的where:beforeBeginafterBeginbeforeEndafterEnd特别要注意,当插入的html包含script标签的时候,需要在script标签之前添加其他的text或者tag,... 阅读全文
posted @ 2013-06-09 20:49 dlbrant 阅读(581) 评论(0) 推荐(0)

摘要:安装完Report Viewer 10 (2010) 后到目录“C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\ReportingServices” 下修改Microsoft.ReportingServices.targets文件将第一行“<UsingTask TaskName="Microsoft.Reporting.RdlCompile" AssemblyName="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, 阅读全文
posted @ 2012-07-09 14:57 dlbrant 阅读(1350) 评论(0) 推荐(0)

摘要:nothing about web app & azure 阅读全文
posted @ 2012-04-23 14:46 dlbrant 阅读(231) 评论(0) 推荐(0)

摘要:Asp.Net MVC项目在编译代码同时编译View,需要手动修改Project文件。用Notepad或其他文本编辑器打开Project文件,或者直接在Visual Studio中Unload project,然后右键点Project,选择Edit Project菜单,将MvcBuildViews改为true,如下:<MvcBuildViews>true</MvcBuildViews>修改后保存并Reload project,此时编译代码的同时也会编译各个View。如果出现如下编译错误Error 47 It is an error to use a section re 阅读全文
posted @ 2012-04-05 15:29 dlbrant 阅读(1563) 评论(3) 推荐(0)

摘要:jQuery Mobile页面解构jQuery Mobile 的“页面”结构不同于传统的html页面,这样做是为了优化single page application的用户体验。利用jQuery Mobile可以使web应用达到和本地应用同样的用户体验,这是传统web应用无法实现的。同时如果由于跨域名或者其他原因禁用了Ajax的话,jquery mobile也能平滑的降级为传统的web应用,it just works。jQuery mobile页面结构jQuery mobile站点的页面必须以HTML5的doctype开头,即 “<!DOCTYPE html>”(不支持HTML5的浏 阅读全文
posted @ 2012-04-01 18:32 dlbrant 阅读(4013) 评论(0) 推荐(0)

摘要:发布Asp.Net MVC项目需要注意修改project references中的Copy local。测试环境:Window Server 2008 + .Net 4.0 + IIS7+ SQL Server 2008问题:编译好的发布包导入IIS7 后,通过浏览器browse web site,出现cannot load assembly system.web.helpers / system.web.mvc / system.web.razor 等在服务器的GAC中也找不到相应的程序集解决办法:修改一下MVC相关程序集的copy local属性为true:Microsoft.Web.In 阅读全文
posted @ 2012-04-01 16:48 dlbrant 阅读(330) 评论(0) 推荐(0)

摘要:Compiler Error Message: CS0016: Could not write to output file - Access is denied.Description:An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: 阅读全文
posted @ 2012-02-02 13:23 dlbrant 阅读(223) 评论(0) 推荐(0)

摘要:Web服务器与客户端不在一个时区,显示客户端时间就需要计算与客户端的时差。在服务端存储UTC时间:C#:DateTime date = DateTime.UtcNow;在客户端显示时间时需要取得客户端时区:JavaScript:timeOffset = (new Date()).getTimezoneOffset();(返回以分钟为单位与UTC的时差)在客户端页面显示时间:date=date.AddMinutes(-1 *timeOffset); 阅读全文
posted @ 2012-01-20 11:56 dlbrant 阅读(682) 评论(0) 推荐(0)

摘要:MVC中客户端传值到服务器端时,如果客户端字符串含有“</>"字样时就会报“检测到有潜在危险”("A potentially dangerous Request.Form value was detected from the client")的错误。 如:从客户端("test<br/>ttt")中检测到有潜在危险的 Request.Form 值。 解决方法A:在对应的Action加上[ValidateInput(false)]属性就可以解决,去除验证。但似乎在.NET 4.0这个属性不工作,所以在web.config中 阅读全文
posted @ 2012-01-20 11:15 dlbrant 阅读(645) 评论(0) 推荐(0)

摘要:异步邮件阻塞MVC请求问题代码如下:public class EmailHelper { private MailHost mailHost = null; private HttpContext context; public event SendMailComplete SendComplete; private SmtpClient client; public EmailHelper() { context = HttpContext.Current; client = new SmtpClient(); mailHo... 阅读全文
posted @ 2012-01-20 11:03 dlbrant 阅读(305) 评论(0) 推荐(0)

摘要:使用CWebBrowser2 / IHTMLDocument2 分析Html,获取特定的html标签 阅读全文
posted @ 2009-02-17 17:53 dlbrant 阅读(4755) 评论(0) 推荐(0)

摘要:JavaScript使用IE控件调用C++代码 阅读全文
posted @ 2009-02-17 14:22 dlbrant 阅读(6281) 评论(3) 推荐(0)

摘要:C++通过CWebbrowser2调用JavaScript 阅读全文
posted @ 2009-02-16 13:50 dlbrant 阅读(5378) 评论(0) 推荐(0)

Software