草庐IT

Window_sendPlatformMessage

全部标签

JavaScript/jQuery : how do I get the inner window height?

比如...不包括地址栏、书签等的高度,只是查看空间。$(window).innerHeight()似乎不起作用。 最佳答案 使用.height()为此,如API中所述:Thismethodisalsoabletofindtheheightofthewindowanddocument.$(window).height();//returnsheightofbrowserviewport$(document).height();//returnsheightofHTMLdocument至于为什么.innerHeight()不工作:Thi

javascript - window.onbeforeunload : Is it possible to get any details about how the window was unloaded?

我正在开发其中一个警告窗口,告诉用户他们可能有未保存的数据,但我只需要在他们离开页面时警告他们。目前它在刷新、回发等时这样做。我想知道是否有任何方法可以告诉页面是如何卸载的,或者以其他方式获取有关用户卸载页面的操作的更多详细信息。(欢迎使用jquery解决方案)。引用代码:window.onbeforeunload=function(){if(formIsDirty){formIsDirty=false;return"Areyousureyouwanttonavigateawayfromthispage?";}} 最佳答案 在bef

javascript - 传递给 window.prompt 的文本被替换为 "..."

我想允许用户将大量电子邮件地址复制到他们的剪贴板。这个答案似乎是最可靠的方法:HowdoIcopytotheclipboardinJavaScript?但是,在测试时我发现window.prompt()总是将部分one的电子邮件替换为....测试数据如下:test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;test@test.com;

javascript - 为什么 window.location 追加而不是替换 ie 中的 URL

我在ie中收到错误的URL,但在firefox和chrome中却没有。基本上,我有一个名为文本搜索的文本字段。我在htaccess中使用jQuery和rewriterule来内部重定向页面。我在本地主机上,所有文件都在一个名为test的文件夹中。在firefox和chrome中,如果您在文本搜索框中输入“你好”按回车键、“嗨”按回车键和“再见”按回车键,您将获得正确的URL作为本地主机/测试/测试/你好和本地主机/测试/测试/嗨和本地主机/测试/测试/再见分别。在即你得到本地主机/测试/测试/你好和本地主机/测试/测试/测试/嗨和本地主机/测试/测试/测试/测试/再见分别这里的问题是“

javascript - JS "Window"宽高与 "screen"宽高?

当我看到这段代码时,我有点疑惑://GetthescreenheightandwidthvarmaskHeight=$(document).height();varmaskWidth=$(window).width();...//GetthewindowheightandwidthvarwinH=$(window).height();varwinW=$(window).width();$(document).height();和$(window).height();有什么区别? 最佳答案 Window是顶级客户端对象,其中包含文档。

javascript - 为什么 window.location.search 是空的?

如果我console.log(window.location)我得到这个:Location{replace:function,assign:function,ancestorOrigins:DOMStringList,origin:"https://localhost:3000",hash:"#/account/content?hello=world"…}ancestorOrigins:DOMStringListassign:function(){[nativecode]}hash:"#/account/content?hello=world"host:"localhost:3000"

javascript - Firefox 中的 open() 和 window.open() 有什么区别?

在回答myquestionPumbaa80found调用open()和window.open()的区别,请尝试以下示例在Firefox中(在11.0上测试):http://jsfiddle.net/9kqp5/(调用open;在FF中的新选项卡中打开,前提是“改为在新选项卡中打开新窗口”设置已打开,这是默认设置)http://jsfiddle.net/HLbLu/(调用window.open;在新的小窗口中打开)但为什么会有差异呢?如果我尝试followingexample:vara=2;functionhello(){alert(this.a);}hello();window.hel

javascript - $(window).hashchange() 不起作用

你好,我正在尝试使用浏览器后退按钮,我了解如何使用hashchange插件捕获事件=>$(window).hashchange(function(){alert(location.hash);});$(window).hashchange();当我尝试加载新页面时,没有任何反应......有没有办法用新的url“重新加载”页面?谢谢! 最佳答案 试试这个:$(window).on('hashchange',function(){//Yourcodegoeshere}).trigger('hashchange');//bindeven

javascript - window[] 和 eval() 之间的区别 - Javascript

我一直在javascript中使用两者...真的不知道有什么区别。谷歌搜索总是显示“窗口对象”或“在javascript中打开一个新窗口”的结果,所以在那里找不到任何东西。eval("v"+e)window["v"+e]有时window对我有用,有时eval有用....那么eval()和window[]有什么区别呢?抱歉新手问题!诺曼 最佳答案 另一点尚未解决的是,eval将使用调用者变量环境解析变量引用,例如:varfoo="global";(function(){varfoo="local";alert(eval("foo"))

javascript - window.location.indexOf 在 Javascript 中不起作用

下面是我的。varmyString="http://localhost:8888/www.smart-kw.com/";alert(myString.indexOf("localhost"));这会提醒我...但是如果我将varmyString="http://localhost:8888/www.smart-kw.com/";更改为varmyString=window.location;,它不起作用(我没有收到警报)。varmyString=window.location;alert(myString.indexOf("localhost")); 最佳答案