简体   繁体   English

可以使用python应用程序引擎在URL中查找#

[英]Possible to find out if # in URL with python app engine

Is there a way to find out if the current URL for the webhandler contains a # ? 有没有办法找出当前Webhandler的URL是否包含#? I can't get written out the URL when i use a #. 使用#时无法写出URL。 self.request.url returns only the base URL when a URL with # is GET on server. 当带有#的URL在服务器上为GET时, self.request.url仅返回基本URL。

I have also tried to send the rest of the URL as an argument and print that. 我还尝试过将URL的其余部分作为参数发送并打印出来。

('/(.*)', MainHandler),
class MainHandler(webapp2.RequestHandler):
    def get(self, args):
        self.response.out.write(args)

This will not post anything on args argument when URL is GET with a # in the URL. 当URL为GET且URL中带有#时,这不会在args参数上发布任何内容。 For everything else it successfully writes the rest of the URL after the base. 对于其他所有内容,它将成功地将其余URL写入基址之后。 Example on what kind of URL i'm trying to show: http://instahashtag.appspot.com/#/14212311 我尝试显示哪种URL的示例: http : //instahashtag.appspot.com/#/14212311

Am i missing something here? 我在这里想念什么吗?

The URL fragment is handled by the browser and is not passed to the server. URL片段由浏览器处理,并且不传递给服务器。 If you need to handle it you need to write client-side code (most likely in JavaScript). 如果需要处理它,则需要编写客户端代码(最有可能在JavaScript中)。

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

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