草庐IT

location-services

全部标签

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

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

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"

没有 www 的 Javascript location.host

我有一个php文件,用于在Facebook和Twitter上分享我的用户的帖子。例如,如果我点击Twitter图标,我会看到一个屏幕,其中自动写入了指向我网站的超链接。这很好,但我想删除自动显示在Twitter屏幕上的url的www.部分。我猜这与location.host有关,所以我用google搜索,但找不到这个问题的正确答案。这是我的代码示例:functione(f,i,an){with(document){write('');write(' ');write('');write('');write('(#'+i+')');document.write(' '

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")); 最佳答案

javascript - 如何使用 window.location 获取子域?

如果我有一个主机名,例如:http://sample.example.com在Javascript中,我执行window.location.hostname,我会得到“example.com”还是“sample.example.com”?如果没有,我怎么能得到sample.example.com? 最佳答案 是的,window.location.hostname也会为您提供子域。如果这不起作用,或者某些其他浏览器不支持,您可以很容易地解析它://window.location.href=="http://sample.somedom

javascript - 当我尝试缓存 xxx.worker.js 时,Service Worker 不会安装

我的Vue应用程序中有以下服务worker代码:ma​​in.jsif(navigator.serviceWorker){navigator.serviceWorker.register('/service-worker.js').catch(function(){console.log('Serviceworkerregistrationfailed.');});}service-worker.jsletcurrCacheName='premium-poker-tools-5';self.addEventListener('install',function(event){event

javascript - history.back() 不会在 Chrome/FireFox 中更新 location.hash

我尝试构建一个JS脚本来更改页面的位置,然后返回直到找到特定的哈希位置:varStopAtThisHash='#';varCurrentHash=window.location.hash;varcontinueLoop=true;while((window.history.length>0)&&(continueLoop)){window.history.back();varNowWeAreAtHash=window.location.hash;//thisneverchangesinChrome//actually,alwaysseemsto:CurrentHash==NowWeAr

javascript - azure service bus队列使用nodejs读取批量消息

我想使用nodejsazure包从azure服务总线队列中批量获取消息,现在我可以使用set-interval获取消息。有没有其他方法可以批量获取消息。 最佳答案 服务总线RESTAPI当前不支持接收批处理,因此此库中没有有效的实现。部分原因是REST实现的性能不是特别好,使用AMQP要好得多。如果您正在寻找性能更好的东西,我会看看这个库:https://github.com/noodlefrenzy/node-amqp10关于的相关问题github你也可以试试这个out。 关于java

javascript - AngularJS : Should service's boolean method return promise that resolves to true/false, 或者被解决/拒绝?

promise的使用模式仍然让我感到困惑。例如,在Angular应用程序中,我有一个服务usersService,方法是emailExists(email)。显然,它向服务器请求检查给定的电子邮件是否已经存在。让方法emailExists(email)返回在正常操作中解析为true或false的promise对我来说感觉很自然.如果只是我们有一些意外的错误(比如,服务器返回500:内部服务器错误,那么promise应该被拒绝,但在正常操作中,它被解析为相应的bool值。然而,当我开始实现我的异步验证器指令(通过$asyncValidators)时,我看到它想要解决/拒绝promise。

javascript - window.location.reload 后转到 anchor 链接

我正在尝试更新哈希,然后重新加载页面。$('a[name="'+fragment+'"]').remove();//don'tjumpbeforewindowreloadswindow.location.hash=fragment;window.location.reload(true);重新加载窗口后不会跳转到anchor标记。我该如何解决? 最佳答案 如果您要重新加载页面,这在jQuery中实现起来相当简单。加载页面时只需检查window.location.hash属性即可。$(document).ready(function(