Javascript execution inside PHP redirect

I experimented with forwarding PHP until the end of creating a modal window that appears only with a link and without a modal script on the current page.

With PHP you can forward like this:

<?php
header( "Location: http://example.com" );

You can also forward alternative URL schemes, for example, you can open an SMS message like this:

<?php
header( "Location: sms:867-5309" );

So, for example, you could " http://yoursite.com/phone-number.php " start an sms conversation on a supporting device, and also keep the remaining page open.

I also saw that people use the "javascript:" URL scheme to run javascript from the address bar of a browser or bookmarklet.


: , Javscript PHP, , :

<?php
header( "Location: javascript:alert('hey!');" );

: ?

+4
1

, URI- javascript - , JS. , :

<a onclick="alert('hey!')">Click me!</a>

Javascript " ", - Ajax serveride, onSuccess JS , .

, jQuery Mootools, eval, Ajax Javascript , , .

+5

Source: https://habr.com/ru/post/1528223/


All Articles