javascript - 使用php获取一个通过JS跳转的最终网址

WBOY
Release: 2016-06-06 20:35:41
Original
1845 people have browsed it

地址为:http://prosperent.com/store/product/411677-18579-0/?k=CARDINAL+12132+E...

最终地址:http://www.walmart.com/ip/Cardinal-Brands-Inc-Clearvue-EasyOpen-Extra-...

使用的是这段JS跳转,无奈不懂JS,无从下手啊

<code>        var getParams = function()
        {
            var params = {};
            window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
                params[key] = value;
            });

            return params;
        };
</code>
Copy after login
Copy after login

回复内容:

地址为:http://prosperent.com/store/product/411677-18579-0/?k=CARDINAL+12132+E...

最终地址:http://www.walmart.com/ip/Cardinal-Brands-Inc-Clearvue-EasyOpen-Extra-...

使用的是这段JS跳转,无奈不懂JS,无从下手啊

<code>        var getParams = function()
        {
            var params = {};
            window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
                params[key] = value;
            });

            return params;
        };
</code>
Copy after login
Copy after login

getParams() 是把 url 里面的 querystring 提取出来,例如:

'?a=1&b=2' => { a: '1', b: '2' }

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!